]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Die on SIGINT only if we're running standalone or not handling clients.
authorTimo Sirainen <tss@iki.fi>
Wed, 9 Dec 2009 23:00:17 +0000 (18:00 -0500)
committerTimo Sirainen <tss@iki.fi>
Wed, 9 Dec 2009 23:00:17 +0000 (18:00 -0500)
--HG--
branch : HEAD

src/lib-master/master-service.c

index 16b2697784f81cecdb3f5d25ef622a9173e78112..fdbb695de9c7c7766753be74359ef9e4d3119016 100644 (file)
@@ -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);
 }