From cbe9c0212b45d66ab5c8a86fa754c5c94232daba Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 16 Jun 2009 15:08:18 +0200 Subject: [PATCH] Attempt to fix bug 6476 In inetd mode we can't fork, because we don't listen to the SIGCLD signals. Adding that to the main smbd loop is larger, I think we should get away with this for now. Jeremy, please review! --- source/include/proto.h | 1 + source/printing/print_cups.c | 14 ++++++++++++++ source/smbd/server.c | 1 + 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/source/include/proto.h b/source/include/proto.h index ec8637b..e1db56b 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -6585,6 +6585,7 @@ bool aix_cache_reload(void); /* The following definitions come from printing/print_cups.c */ +void enable_async_cups_pcap_load(void); bool cups_cache_reload(void); bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer); diff --git a/source/printing/print_cups.c b/source/printing/print_cups.c index 261116a..cb67717 100644 --- a/source/printing/print_cups.c +++ b/source/printing/print_cups.c @@ -386,6 +386,16 @@ static bool cups_cache_reload_async(int fd) static struct pcap_cache *local_pcap_copy; struct fd_event *cache_fd_event; +static bool do_async_pcap_load = false; + +/* + * This is a *bad* hack that is necessary in inetd-mode where we don't handle + * SIGCHLD. + */ +void enable_async_cups_pcap_load(void) +{ + do_async_pcap_load = true; +} static bool cups_pcap_load_async(int *pfd) { @@ -394,6 +404,10 @@ static bool cups_pcap_load_async(int *pfd) *pfd = -1; + if (!do_async_pcap_load) { + return false; + } + if (cache_fd_event) { DEBUG(3,("cups_pcap_load_async: already waiting for " "a refresh event\n" )); diff --git a/source/smbd/server.c b/source/smbd/server.c index 622504d..f98359e 100644 --- a/source/smbd/server.c +++ b/source/smbd/server.c @@ -1408,6 +1408,7 @@ extern void build_options(bool screen); if (is_daemon && !interactive && lp_parm_bool(-1, "smbd", "backgroundqueue", true)) { start_background_queue(); + enable_async_cups_pcap_load(); } if (!open_sockets_smbd(is_daemon, interactive, ports)) -- 1.5.5