From: Michael R Sweet Date: Tue, 16 Jul 2019 13:07:17 +0000 (-0400) Subject: The scheduler would restart continuously when idle and printers were not X-Git-Tag: v2.3.0~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9a4e9d6ea96a93d0b5df2f43b2de087d55b573f;p=thirdparty%2Fcups.git The scheduler would restart continuously when idle and printers were not shared (rdar://52561199) --- diff --git a/CHANGES.md b/CHANGES.md index c1211534b6..58db8c2169 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.3.0 - 2019-06-17 +CHANGES - 2.3.0 - 2019-07-16 ============================ @@ -13,6 +13,8 @@ Changes in CUPS v2.3.0 - Fixed a NULL pointer dereference bug in `httpGetSubField2` (Issue #5598) - Fixed an issue with unsupported "sides" values in the IPP backend (rdar://51775322) +- The scheduler would restart continuously when idle and printers were not + shared (rdar://52561199) - Fixed an issue with `EXPECT !name WITH-VALUE ...` tests. - Fixed a command ordering issue in the Zebra ZPL driver. diff --git a/scheduler/main.c b/scheduler/main.c index 3a2fe7ec90..842b00a42d 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -756,7 +756,10 @@ main(int argc, /* I - Number of command-line args */ #ifdef HAVE_ONDEMAND if (OnDemand) + { + stop_scheduler = 1; break; + } #endif /* HAVE_ONDEMAND */ DoingShutdown = 1; @@ -2048,13 +2051,31 @@ service_checkout(int shutdown) /* I - Shutting down? */ #ifdef HAVE_ONDEMAND if (OnDemand) { + int shared_printers = 0; /* Do we have shared printers? */ + strlcpy(pidfile, CUPS_KEEPALIVE, sizeof(pidfile)); + /* + * If printer sharing is on see if there are any actual shared printers... + */ + + if (Browsing && BrowseLocalProtocols) + { + cupsd_printer_t *p = NULL; /* Current printer */ + + for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers)) + { + if (p->shared) + break; + } + + shared_printers = (p != NULL); + } + if (cupsArrayCount(ActiveJobs) || /* Active jobs */ WebInterface || /* Web interface enabled */ NeedReload || /* Doing a reload */ - (Browsing && BrowseLocalProtocols && cupsArrayCount(Printers))) - /* Printers being shared */ + shared_printers) /* Printers being shared */ { /* * Create or remove the "keep-alive" file based on whether there are active