1 --- cups-1.2.1/scheduler/client.c.orig 2006-05-22 17:34:01.000000000 +0200
2 +++ cups-1.2.1/scheduler/client.c 2006-06-05 14:54:53.436660500 +0200
3 @@ -1882,24 +1882,27 @@
8 fd = open(con->filename, O_RDONLY);
10 - fd = open("/dev/null", O_RDONLY);
14 - cupsdLogMessage(CUPSD_LOG_ERROR,
15 - "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
16 - con->http.fd, con->filename ? con->filename : "/dev/null",
22 + cupsdLogMessage(CUPSD_LOG_ERROR,
23 + "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
24 + con->http.fd, con->filename ? con->filename : "/dev/null",
29 - fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
30 + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
35 con->pipe_pid = pipe_command(con, fd, &(con->file), command, options, root);
41 cupsdLogMessage(CUPSD_LOG_INFO, "Started \"%s\" (pid=%d)", command,
43 --- cups-1.2.1/scheduler/job.c.orig 2006-05-18 23:00:56.000000000 +0200
44 +++ cups-1.2.1/scheduler/job.c 2006-06-05 14:44:04.660114500 +0200
45 @@ -3090,28 +3090,6 @@
47 memset(job->filters, 0, sizeof(job->filters));
49 - filterfds[1][0] = open("/dev/null", O_RDONLY);
51 - if (filterfds[1][0] < 0)
53 - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
55 - snprintf(printer->state_message, sizeof(printer->state_message),
56 - "Unable to open \"/dev/null\" - %s.", strerror(errno));
58 - cupsdAddPrinterHistory(printer);
60 - cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
61 - "Job canceled because the server could not open /dev/null.");
66 - fcntl(filterfds[1][0], F_SETFD, fcntl(filterfds[1][0], F_GETFD) | FD_CLOEXEC);
68 - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: filterfds[%d] = [ %d %d ]",
69 - 1, filterfds[1][0], filterfds[1][1]);
71 for (i = 0, slot = 0, filter = (mime_filter_t *)cupsArrayFirst(filters);
73 i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
74 @@ -3165,36 +3143,43 @@
77 job->print_pipes[0] = -1;
78 - if (!strncmp(printer->device_uri, "file:/dev/", 10) &&
79 - strcmp(printer->device_uri, "file:/dev/null"))
80 - job->print_pipes[1] = open(printer->device_uri + 5,
82 - else if (!strncmp(printer->device_uri, "file:///dev/", 12) &&
83 - strcmp(printer->device_uri, "file:///dev/null"))
84 - job->print_pipes[1] = open(printer->device_uri + 7,
86 + if (!strcmp(printer->device_uri, "file:/dev/null") ||
87 + !strcmp(printer->device_uri, "file:///dev/null"))
88 + job->print_pipes[1] = -1;
90 - job->print_pipes[1] = open(printer->device_uri + 5,
91 - O_WRONLY | O_CREAT | O_TRUNC, 0600);
93 - if (job->print_pipes[1] < 0)
95 - cupsdLogMessage(CUPSD_LOG_ERROR,
96 - "Unable to open output file \"%s\" - %s.",
97 - printer->device_uri, strerror(errno));
98 - snprintf(printer->state_message, sizeof(printer->state_message),
99 - "Unable to open output file \"%s\" - %s.",
100 - printer->device_uri, strerror(errno));
101 + if (!strncmp(printer->device_uri, "file:/dev/", 10))
102 + job->print_pipes[1] = open(printer->device_uri + 5,
103 + O_WRONLY | O_EXCL);
104 + else if (!strncmp(printer->device_uri, "file:///dev/", 12))
105 + job->print_pipes[1] = open(printer->device_uri + 7,
106 + O_WRONLY | O_EXCL);
107 + else if (!strncmp(printer->device_uri, "file:///", 8))
108 + job->print_pipes[1] = open(printer->device_uri + 7,
109 + O_WRONLY | O_CREAT | O_TRUNC, 0600);
111 + job->print_pipes[1] = open(printer->device_uri + 5,
112 + O_WRONLY | O_CREAT | O_TRUNC, 0600);
114 - cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
115 - "Job canceled because the server could not open the "
117 + if (job->print_pipes[1] < 0)
119 + cupsdLogMessage(CUPSD_LOG_ERROR,
120 + "Unable to open output file \"%s\" - %s.",
121 + printer->device_uri, strerror(errno));
122 + snprintf(printer->state_message, sizeof(printer->state_message),
123 + "Unable to open output file \"%s\" - %s.",
124 + printer->device_uri, strerror(errno));
128 + cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
129 + "Job canceled because the server could not open the "
132 - fcntl(job->print_pipes[1], F_SETFD,
133 - fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
137 + fcntl(job->print_pipes[1], F_SETFD,
138 + fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
142 cupsdLogMessage(CUPSD_LOG_DEBUG2,
143 @@ -3274,25 +3259,7 @@
146 filterfds[slot][0] = -1;
147 - filterfds[slot][1] = open("/dev/null", O_WRONLY);
149 - if (filterfds[slot][1] < 0)
151 - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
153 - snprintf(printer->state_message, sizeof(printer->state_message),
154 - "Unable to open \"/dev/null\" - %s.", strerror(errno));
156 - cupsdAddPrinterHistory(printer);
158 - cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
159 - "Job canceled because the server could not open a file.");
164 - fcntl(filterfds[slot][1], F_SETFD,
165 - fcntl(filterfds[slot][1], F_GETFD) | FD_CLOEXEC);
166 + filterfds[slot][1] = -1;
168 cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: backend=\"%s\"",