cups/cups-journal.patch
2015-08-13 11:16:19 +02:00

31 lines
1.6 KiB
Diff

diff -up cups-2.1rc1/scheduler/log.c.journal cups-2.1rc1/scheduler/log.c
--- cups-2.1rc1/scheduler/log.c.journal 2015-08-13 11:12:07.738534615 +0200
+++ cups-2.1rc1/scheduler/log.c 2015-08-13 11:14:41.411980473 +0200
@@ -646,7 +646,7 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
asl_set(m, PWG_Event, "JobStateChanged");
asl_set(m, PWG_JobID, job_id);
- asl_set(m, PWG_JobState, job_states[job->state_value - IPP_JSTATE_PENDING]);
+ asl_set(m, PWG_JobState, job->state_value < IPP_JSTATE_PENDING ? "" : job_states[job->state_value - IPP_JSTATE_PENDING]);
if (job->impressions)
{
@@ -666,7 +666,7 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
if (!strcmp(ErrorLog, "syslog"))
{
- cupsd_printer_t *printer = job->printer ? job->printer : job->dest ? cupsdFindDest(job->dest) : NULL;
+ cupsd_printer_t *printer = job ? (job->printer ? job->printer : (job->dest ? cupsdFindDest(job->dest) : NULL)) : NULL;
static const char * const job_states[] =
{ /* job-state strings */
"Pending",
@@ -696,7 +696,7 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
PWG_Event"=JobStateChanged",
PWG_ServiceURI"=%s", printer ? printer->uri : "",
PWG_JobID"=%d", job->id,
- PWG_JobState"=%s", job_states[job->state_value - IPP_JSTATE_PENDING],
+ PWG_JobState"=%s", job->state_value < IPP_JSTATE_PENDING ? "" : job_states[job->state_value - IPP_JSTATE_PENDING],
PWG_JobImpressionsCompleted"=%d", ippGetInteger(job->impressions, 0),
NULL);
else