• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/scheduler/job.c b/scheduler/job.c
2index 11579875..c4e058e6 100644
3--- a/scheduler/job.c
4+++ b/scheduler/job.c
5@@ -1359,7 +1359,7 @@ cupsdContinueJob(cupsd_job_t *job)	/* I - Job */
6
7   cupsdRemoveSelect(job->status_pipes[0]);
8   cupsdClosePipe(job->status_pipes);
9-  cupsdStatBufDelete(job->status_buffer);
10+  cupsdStatBufDeleteForJob(job->status_buffer);
11   job->status_buffer = NULL;
12
13  /*
14@@ -3170,7 +3170,7 @@ finalize_job(cupsd_job_t *job,		/* I - Job */
15
16   cupsdRemoveSelect(job->status_pipes[0]);
17   cupsdClosePipe(job->status_pipes);
18-  cupsdStatBufDelete(job->status_buffer);
19+  cupsdStatBufDeleteForJob(job->status_buffer);
20   job->status_buffer = NULL;
21
22  /*
23@@ -4968,7 +4968,7 @@ start_job(cupsd_job_t     *job,		/* I - Job ID */
24 		     "back-channel pipes.");
25
26     cupsdClosePipe(job->status_pipes);
27-    cupsdStatBufDelete(job->status_buffer);
28+    cupsdStatBufDeleteForJob(job->status_buffer);
29     job->status_buffer = NULL;
30
31     cupsdDestroyProfile(job->profile);
32@@ -4999,7 +4999,7 @@ start_job(cupsd_job_t     *job,		/* I - Job ID */
33     cupsdClosePipe(job->back_pipes);
34
35     cupsdClosePipe(job->status_pipes);
36-    cupsdStatBufDelete(job->status_buffer);
37+    cupsdStatBufDeleteForJob(job->status_buffer);
38     job->status_buffer = NULL;
39
40     cupsdDestroyProfile(job->profile);
41diff --git a/scheduler/process.c b/scheduler/process.c
42index 7f05a90a..b6a80a67 100644
43--- a/scheduler/process.c
44+++ b/scheduler/process.c
45@@ -639,6 +639,22 @@ cupsdStartProcess(
46
47   cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartProcess: Calling posix_spawn.");
48
49+  int flag = fcntl(3, F_GETFD);
50+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartProcess: backfd flag=%d.", flag);
51+
52+  if (flag == 1)
53+  {
54+    fcntl(3, F_SETFD, 0);
55+  }
56+
57+  flag = fcntl(4, F_GETFD);
58+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartProcess: sidefd flag=%d.", flag);
59+
60+  if (flag == 1)
61+  {
62+    fcntl(4, F_SETFD, 0);
63+  }
64+
65   if (posix_spawn(pid, exec_path, &actions, &attrs, argv, envp ? envp : environ))
66   {
67     cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to fork %s - %s.", command, strerror(errno));
68diff --git a/scheduler/statbuf.c b/scheduler/statbuf.c
69index 5a2530e4..9b71037e 100644
70--- a/scheduler/statbuf.c
71+++ b/scheduler/statbuf.c
72@@ -40,6 +40,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 45fa904b..e78d2ed5 100644
103--- a/scheduler/statbuf.h
104+++ b/scheduler/statbuf.h
105@@ -34,6 +34,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