]> 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>
Thu, 23 Nov 2023 15:07:46 +0000 (16:07 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Thu, 23 Nov 2023 15:07:46 +0000 (16:07 +0100)
scheduler/job.c

index 36474ea74a7a34f454aca558e034d53737cde95e..6efbaf85e5be5eac20091bf176bec9be4bbd2b0a 100644 (file)
@@ -2593,8 +2593,16 @@ cupsdSetJobState(
     case IPP_JSTATE_CANCELED :
     case IPP_JSTATE_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_DEFAULT || !job || !job->printer)
+         ippSetString(job->attrs, &job->reasons, 0, "processing-to-stop-point");
+       break;
   }
 
  /*