From 78b6b2c9875863352924eb937590f7ad7790c23f Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 8 Jun 2021 11:34:27 +0200 Subject: [PATCH] driverless: Exit with 0 if no driverless IPP printers found --- NEWS | 5 +++++ utils/driverless.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 993bd9f5c..2b75d28ec 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ NEWS - OpenPrinting CUPS Filters v1.27.5 - 2020-06-05 CHANGES IN V2.0.0 + - driverless: If there are no driverless IPP printers + available let "driverless" terminate with exit code 0 and + not 1, to follow CUPS' standard of backends in discovery + mode terminating with 0 if there are no appropriate printers + found (Issue #375). - foomatic-rip: The fixes for zero-page-job handling (Pull request #209) broke PostScript streaming support. Changed method to check whether a PostScript input file is non-empty diff --git a/utils/driverless.c b/utils/driverless.c index e86321fde..8d500dd77 100644 --- a/utils/driverless.c +++ b/utils/driverless.c @@ -573,7 +573,7 @@ list_printers (int mode, int reg_type_no, int isFax) if (WIFEXITED(wait_status)) { /* Via exit() anywhere or return() in the main() function */ exit_status = WEXITSTATUS(wait_status); - if (exit_status) + if (exit_status > 1) fprintf(stderr, "ERROR: ippfind (PID %d) stopped with status %d!\n", ippfind_pid, exit_status); } else if (WIFSIGNALED(wait_status) && WTERMSIG(wait_status) != SIGTERM) { @@ -583,7 +583,7 @@ list_printers (int mode, int reg_type_no, int isFax) fprintf(stderr, "ERROR: ippfind (PID %d) stopped on signal %d!\n", ippfind_pid, exit_status); } - if (!exit_status && debug) + if (exit_status < 2 && debug) fprintf(stderr, "DEBUG: ippfind (PID %d) exited with no errors.\n", ippfind_pid); @@ -594,7 +594,7 @@ list_printers (int mode, int reg_type_no, int isFax) error: cupsArrayDelete(service_uri_list_ipps); cupsArrayDelete(service_uri_list_ipp); - return (exit_status); + return (exit_status < 2 ? 0 : exit_status); } int -- 2.47.3