summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/smtpd/smtpd.c')
-rw-r--r--usr.sbin/smtpd/smtpd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index adfc4ec8866..4700f61a1a8 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.258 2015/12/05 21:27:42 mmcc Exp $ */
+/* $OpenBSD: smtpd.c,v 1.259 2015/12/08 17:28:03 sunil Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -322,14 +322,15 @@ static void
parent_sig_handler(int sig, short event, void *p)
{
struct child *child;
- int die = 0, status, fail;
+ int die = 0, die_gracefully = 0, status, fail;
pid_t pid;
char *cause;
switch (sig) {
case SIGTERM:
case SIGINT:
- die = 1;
+ log_info("info: %s, shutting down", strsignal(sig));
+ die_gracefully = 1;
/* FALLTHROUGH */
case SIGCHLD:
do {
@@ -424,6 +425,8 @@ parent_sig_handler(int sig, short event, void *p)
if (die)
parent_shutdown(1);
+ else if (die_gracefully)
+ parent_shutdown(0);
break;
default:
fatalx("smtpd: unexpected signal");