_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
static const char * const attrs[] = /* Requested attributes */
{
+ "document-format",
"job-id",
- "job-priority",
"job-k-octets",
+ "job-name",
+ "job-originating-user-name",
+ "job-printer-uri",
+ "job-priority",
"job-state",
"time-at-completed",
"time-at-creation",
- "time-at-processing",
- "job-printer-uri",
- "document-format",
- "job-name",
- "job-originating-user-name"
+ "time-at-processing"
};
char buffer[8192]; /* Copy buffer */
ssize_t bytes; /* Bytes in buffer */
http_status_t status; /* Status of write */
+ _cups_globals_t *cg = _cupsGlobals(); /* Global data */
+ ipp_status_t cancel_status; /* Status code to preserve */
+ char *cancel_message; /* Error message to preserve */
DEBUG_printf(("cupsPrintFiles2(http=%p, name=\"%s\", num_files=%d, "
* Unable to open print file, cancel the job and return...
*/
- cupsCancelJob2(http, name, job_id, 0);
- return (0);
+ _cupsSetError(IPP_DOCUMENT_ACCESS_ERROR, NULL, 0);
+ goto cancel_job;
}
do
* Unable to queue, cancel the job and return...
*/
- cupsCancelJob2(http, name, job_id, 0);
- return (0);
+ goto cancel_job;
}
}
return (job_id);
+
+ /*
+ * If we get here, something happened while sending the print job so we need
+ * to cancel the job without setting the last error (since we need to preserve
+ * the current error...
+ */
+
+ cancel_job:
+
+ cancel_status = cg->last_error;
+ cancel_message = cg->last_status_message ?
+ _cupsStrRetain(cg->last_status_message) : NULL;
+
+ cupsCancelJob2(http, name, job_id, 0);
+
+ cg->last_error = cancel_status;
+ cg->last_status_message = cancel_message;
+
+ return (0);
}