case IPP_JOB_ABORTED :
case IPP_JOB_CANCELED :
case IPP_JOB_COMPLETED :
- /*
- * Expire job subscriptions since the job is now "completed"...
- */
+ if (newstate == IPP_JOB_CANCELED)
+ {
+ /*
+ * Remove the job from the active list if there are no processes still
+ * running for it...
+ */
- cupsdExpireSubscriptions(NULL, job);
+ for (i = 0; job->filters[i] < 0; i++);
+
+ if (!job->filters[i] && job->backend <= 0)
+ cupsArrayRemove(ActiveJobs, job);
+ }
+ else
+ {
+ /*
+ * Otherwise just remove the job from the active list immediately...
+ */
+
+ cupsArrayRemove(ActiveJobs, job);
+ }
/*
- * Remove the job from the active list...
+ * Expire job subscriptions since the job is now "completed"...
*/
- cupsArrayRemove(ActiveJobs, job);
+ cupsdExpireSubscriptions(NULL, job);
#ifdef __APPLE__
/*
cupsdLogMessage(CUPSD_LOG_DEBUG2, "finalize_job(job=%p(%d))", job, job->id);
/*
- * Clear the "connecting-to-device" and "com.apple.print.recoverable-warning"
- * reasons, which are only valid when a printer is processing...
+ * Clear the "connecting-to-device" reason, which is only valid when a printer
+ * is processing...
*/
cupsdSetPrinterReasons(job->printer, "-connecting-to-device");
- cupsdSetPrinterReasons(job->printer, "-com.apple.print.recoverable-warning");
/*
* Similarly, clear the "offline-report" reason for non-USB devices since we
attr->value_tag == IPP_TAG_BEGIN_COLLECTION) /* Not yet supported */
continue;
- if (!strncmp(attr->name, "time-", 5))
+ if (!strncmp(attr->name, "time-", 5) ||
+ !strcmp(attr->name, "job-hold-until"))
continue;
if (!strncmp(attr->name, "job-", 4) &&
fcntl(job->side_pipes[1], F_SETFL,
fcntl(job->side_pipes[1], F_GETFL) | O_NONBLOCK);
+ fcntl(job->side_pipes[0], F_SETFD,
+ fcntl(job->side_pipes[0], F_GETFD) | FD_CLOEXEC);
+ fcntl(job->side_pipes[1], F_SETFD,
+ fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC);
+
/*
* Now start the first file in the job...
*/
cupsFreeOptions(num_keywords, keywords);
}
- else if (!strncmp(message, "recoverable:", 12))
+ else
{
- ptr = message + 12;
- while (isspace(*ptr & 255))
- ptr ++;
+ /*
+ * Strip legacy message prefix...
+ */
- if (*ptr)
+ if (!strncmp(message, "recoverable:", 12))
{
- if (cupsdSetPrinterReasons(job->printer,
- "+com.apple.print.recoverable-warning") ||
- !job->printer->recoverable ||
- strcmp(job->printer->recoverable, ptr))
- {
- cupsdSetString(&(job->printer->recoverable), ptr);
- cupsdAddPrinterHistory(job->printer);
- event |= CUPSD_EVENT_PRINTER_STATE;
- }
+ ptr = message + 12;
+ while (isspace(*ptr & 255))
+ ptr ++;
}
- }
- else if (!strncmp(message, "recovered:", 10))
- {
- ptr = message + 10;
- while (isspace(*ptr & 255))
- ptr ++;
-
- if (cupsdSetPrinterReasons(job->printer,
- "-com.apple.print.recoverable-warning") ||
- !job->printer->recoverable || strcmp(job->printer->recoverable, ptr))
+ else if (!strncmp(message, "recovered:", 10))
{
- cupsdSetString(&(job->printer->recoverable), ptr);
- cupsdAddPrinterHistory(job->printer);
- event |= CUPSD_EVENT_PRINTER_STATE;
+ ptr = message + 10;
+ while (isspace(*ptr & 255))
+ ptr ++;
}
- }
- else
- {
- cupsdLogJob(job, loglevel, "%s", message);
+ else
+ ptr = message;
+
+ cupsdLogJob(job, loglevel, "%s", ptr);
if (loglevel < CUPSD_LOG_DEBUG)
{
- strlcpy(job->printer->state_message, message,
+ strlcpy(job->printer->state_message, ptr,
sizeof(job->printer->state_message));
cupsdAddPrinterHistory(job->printer);