]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Let filterExternalCUPS() return 1 if filter gets a signal
authorTill Kamppeter <till.kamppeter@gmail.com>
Mon, 18 Oct 2021 21:38:37 +0000 (23:38 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Mon, 18 Oct 2021 21:38:37 +0000 (23:38 +0200)
If the CUPS filter or backend called by the filterExternalCUPS()
filter function stops on a signal (like for example signal 11,
segmentation fault) filterExternalCUPS() returns 1 now and not a value
> 256.  Otherwise filterChain() will not see the failure (exit() only
passes on the last byte of its argument as exit code) and returns 0
for success, making a job with a crashed filter appear as succeeded.

cupsfilters/filter.c

index b7554ae8756ae9fca2981969483c0ceacbb01869..d228e115f260f02080c8a6954c6acd21ca90ea95 100644 (file)
@@ -1236,7 +1236,6 @@ filterExternalCUPS(int inputfd,         /* I - File descriptor input stream */
                      (params->is_backend ? "Backend" : "Filter") :
                      "Logging"),
                     wpid, WEXITSTATUS(wstatus));
-       status = WEXITSTATUS(wstatus);
       } else {
        /* Via signal */
        if (log) log(ld, FILTER_LOGLEVEL_ERROR,
@@ -1246,8 +1245,8 @@ filterExternalCUPS(int inputfd,         /* I - File descriptor input stream */
                      (params->is_backend ? "Backend" : "Filter") :
                      "Logging"),
                     wpid, WTERMSIG(wstatus));
-       status = 256 * WTERMSIG(wstatus);
       }
+      status = 1;
     } else {
       if (log) log(ld, FILTER_LOGLEVEL_INFO,
                   "filterExternalCUPS (%s): %s (PID %d) exited with no errors.",