]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Use "purge-job" instead of "purge-jobs" when canceling a single job (#742)
authorBryan Mason <bmason@redhat.com>
Tue, 27 Jun 2023 11:18:46 +0000 (04:18 -0700)
committerGitHub <noreply@github.com>
Tue, 27 Jun 2023 11:18:46 +0000 (13:18 +0200)
The command "cancel -x <job>" adds "purge-jobs true" to the Cancel-Job
operation; however, the correct attribute to use for Cancel-job is
"purge-job" (singular), not "purge-jobs" (plural).  As a result, job
files are not removed from /var/spool/cups when "cancel -x <job>" is
executed.

This patch resolves the issue by adding "purge-job" when the IPP
operation is Cancel-Job and "purge-jobs" for other IPP operations
(Purge-Jobs, Cancel-Jobs, and Cancel-My-Jobs)

systemv/cancel.c

index 572f413e13695faf0e661fdfac756e332163f7b5..f5b8e12b5e5071233095c74a8dbac87d3a2f7fa8 100644 (file)
@@ -260,6 +260,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       *    attributes-natural-language
       *    printer-uri + job-id *or* job-uri
       *    [requesting-user-name]
+      *    [purge-job] or [purge-jobs]
       */
 
       request = ippNewRequest(op);
@@ -294,7 +295,12 @@ main(int  argc,                            /* I - Number of command-line arguments */
                      "requesting-user-name", NULL, cupsUser());
 
       if (purge)
-       ippAddBoolean(request, IPP_TAG_OPERATION, "purge-jobs", (char)purge);
+      {
+       if (op == IPP_CANCEL_JOB)
+         ippAddBoolean(request, IPP_TAG_OPERATION, "purge-job", (char)purge);
+       else
+         ippAddBoolean(request, IPP_TAG_OPERATION, "purge-jobs", (char)purge);
+      }
 
      /*
       * Do the request and get back a response...