• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/scheduler/cups-exec.c b/scheduler/cups-exec.c
2index 7b851d3..d9df71c 100644
3--- a/scheduler/cups-exec.c
4+++ b/scheduler/cups-exec.c
5@@ -116,7 +116,22 @@ main(int  argc,				/* I - Number of command-line args */
6   * Make sure side and back channel FDs are non-blocking...
7   */
8
9+  FILE *file = fopen("/dev/null", "r+");
10+  int fd = fileno(file);
11+  if (fd > 3)
12+  {
13+    dup2(fd, 3);
14+    fclose(file);
15+  }
16   fcntl(3, F_SETFL, O_NDELAY);
17+
18+  file = fopen("/dev/null", "r+");
19+  fd = fileno(file);
20+  if (fd > 4)
21+  {
22+    dup2(fd, 4);
23+    fclose(file);
24+  }
25   fcntl(4, F_SETFL, O_NDELAY);
26
27  /*
28diff --git a/scheduler/job.c b/scheduler/job.c
29index fd69f71..f44c522 100644
30--- a/scheduler/job.c
31+++ b/scheduler/job.c
32@@ -1355,7 +1355,7 @@ cupsdContinueJob(cupsd_job_t *job)	/* I - Job */
33
34   cupsdRemoveSelect(job->status_pipes[0]);
35   cupsdClosePipe(job->status_pipes);
36-  cupsdStatBufDelete(job->status_buffer);
37+  cupsdStatBufDeleteForJob(job->status_buffer);
38   job->status_buffer = NULL;
39
40  /*
41@@ -3144,7 +3144,7 @@ finalize_job(cupsd_job_t *job,		/* I - Job */
42
43   cupsdRemoveSelect(job->status_pipes[0]);
44   cupsdClosePipe(job->status_pipes);
45-  cupsdStatBufDelete(job->status_buffer);
46+  cupsdStatBufDeleteForJob(job->status_buffer);
47   job->status_buffer = NULL;
48
49  /*
50@@ -4919,7 +4919,7 @@ start_job(cupsd_job_t     *job,		/* I - Job ID */
51 		     "back-channel pipes.");
52
53     cupsdClosePipe(job->status_pipes);
54-    cupsdStatBufDelete(job->status_buffer);
55+    cupsdStatBufDeleteForJob(job->status_buffer);
56     job->status_buffer = NULL;
57
58     cupsdDestroyProfile(job->profile);
59@@ -4950,7 +4950,7 @@ start_job(cupsd_job_t     *job,		/* I - Job ID */
60     cupsdClosePipe(job->back_pipes);
61
62     cupsdClosePipe(job->status_pipes);
63-    cupsdStatBufDelete(job->status_buffer);
64+    cupsdStatBufDeleteForJob(job->status_buffer);
65     job->status_buffer = NULL;
66
67     cupsdDestroyProfile(job->profile);
68diff --git a/scheduler/statbuf.c b/scheduler/statbuf.c
69index db9d98d..18eb7b8 100644
70--- a/scheduler/statbuf.c
71+++ b/scheduler/statbuf.c
72@@ -39,6 +39,28 @@ cupsdStatBufDelete(cupsd_statbuf_t *sb)	/* I - Status buffer */
73 }
74
75
76+/*
77+ * 'cupsdStatBufDeleteForJob()' - Destroy a status buffer.
78+ */
79+
80+void
81+cupsdStatBufDeleteForJob(cupsd_statbuf_t *sb)	/* I - Status buffer */
82+{
83+ /*
84+  * Range check input...
85+  */
86+
87+  if (!sb)
88+    return;
89+
90+ /*
91+  * Free memory used...
92+  */
93+
94+  free(sb);
95+}
96+
97+
98 /*
99  * 'cupsdStatBufNew()' - Create a new status buffer.
100  */
101diff --git a/scheduler/statbuf.h b/scheduler/statbuf.h
102index 4ac7c81..196cd6d 100644
103--- a/scheduler/statbuf.h
104+++ b/scheduler/statbuf.h
105@@ -33,6 +33,7 @@ typedef struct				/**** Status buffer */
106  */
107
108 extern void		cupsdStatBufDelete(cupsd_statbuf_t *sb);
109+extern void		cupsdStatBufDeleteForJob(cupsd_statbuf_t *sb);
110 extern cupsd_statbuf_t	*cupsdStatBufNew(int fd, const char *prefix, ...);
111 extern char		*cupsdStatBufUpdate(cupsd_statbuf_t *sb, int *loglevel,
112 			                    char *line, int linelen);
113