From: Zdenek Dohnal Date: Thu, 23 Nov 2023 15:07:46 +0000 (+0100) Subject: scheduler: Set reasons in cupsdSetJobState only if we call finalize_job later X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a4011c3092df928fc0f1ed80b71f7f1ef4e371a;p=thirdparty%2Fcups.git scheduler: Set reasons in cupsdSetJobState only if we call finalize_job later --- diff --git a/scheduler/job.c b/scheduler/job.c index 36474ea74a..6efbaf85e5 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -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; } /*