From: Timo Sirainen Date: Wed, 9 Dec 2009 23:00:17 +0000 (-0500) Subject: lib-master: Die on SIGINT only if we're running standalone or not handling clients. X-Git-Tag: 2.0.beta1~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b437874782ad048daa155e0ac863c2326c3f5e43;p=thirdparty%2Fdovecot%2Fcore.git lib-master: Die on SIGINT only if we're running standalone or not handling clients. --HG-- branch : HEAD --- diff --git a/src/lib-master/master-service.c b/src/lib-master/master-service.c index 16b2697784..fdbb695de9 100644 --- a/src/lib-master/master-service.c +++ b/src/lib-master/master-service.c @@ -49,14 +49,21 @@ static void sig_die(const siginfo_t *si, void *context) { struct master_service *service = context; - /* warn about being killed because of some signal, except SIGINT (^C) - which is too common at least while testing :) */ + /* SIGINT comes either from master process or from keyboard. we don't + want to log it in either case.*/ if (si->si_signo != SIGINT) { i_warning("Killed with signal %d (by pid=%s uid=%s code=%s)", si->si_signo, dec2str(si->si_pid), dec2str(si->si_uid), lib_signal_code_to_str(si->si_signo, si->si_code)); + } else if ((service->flags & MASTER_SERVICE_FLAG_STANDALONE) == 0) { + /* SIGINT came from master. die only if we're not handling + any clients currently. */ + if (service->master_status.available_count != + service->total_available_count) + return; } + io_loop_stop(service->ioloop); }