]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler: Set reasons in cupsdSetJobState only if we call finalize_job later
authorZdenek Dohnal <zdohnal@redhat.com>
Mon, 27 Nov 2023 11:59:18 +0000 (12:59 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 27 Nov 2023 11:59:18 +0000 (12:59 +0100)
Before the fix, every successfully printed jobs ended up with
'processing-to-stop-point' as the last reasons message.

Final fix for #828 .

CHANGES.md
scheduler/job.c

index f494a075a61758fa34838449040e3562646a0737..15977239ed28cd33cc93c2fd260b1886b3cf2da8 100644 (file)
@@ -11,6 +11,7 @@ Changes in CUPS v2.4.8 (TBA)
 - Fixed crash in `scan_ps()` if incoming argument is NULL (Issue #831)
 - Fixed memory leak when creating color profiles (Issue #815)
 - Fixed memory leak when unloading a job (Issue #813)
+- Fixed setting job state reasons for successful jobs (Issue #832)
 - Raised `cups_enum_dests()` timeout for listing available IPP printers (Issue #751)
 - Really backport fix for Issue #742
 
index 768b099651cf2f329c47b0dacc3a0fc122d4045a..093272329b9c3556fa2f87a30ed5bb04af704b23 100644 (file)
@@ -2608,8 +2608,16 @@ cupsdSetJobState(
     case IPP_JOB_CANCELED :
     case IPP_JOB_COMPLETED :
        set_time(job, "time-at-completed");
-       ippSetString(job->attrs, &job->reasons, 0, "processing-to-stop-point");
-        break;
+
+       /*
+       * Set the reasons here only if we call finalize_job()
+       * at the end of this function, so finished jobs can get proper
+       * reasons message there...
+       */
+
+       if (action >= CUPSD_JOB_FORCE && job && job->printer)
+         ippSetString(job->attrs, &job->reasons, 0, "processing-to-stop-point");
+       break;
   }
 
  /*