diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2021-02-06 16:04:24 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2021-02-06 17:18:38 +0000 |
commit | beb5d85c7d378d48dda18a3ad8fab0599a75edc1 (patch) | |
tree | 728245c246bb5135806c9dad66ab8ac14a60ba33 /src | |
parent | 3bb1e9f161fd22707bc7cfcd77772422ac0fdd8e (diff) |
Fix daemon-SIGHUP on FreeBSD
Diffstat (limited to 'src')
-rw-r--r-- | src/src/daemon.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/src/daemon.c b/src/src/daemon.c index 1006961d3..50c202c56 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -128,11 +128,30 @@ if (smtp_out) smtp_printf("421 %s\r\n", FALSE, smtp_msg); /************************************************* *************************************************/ +#ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS +static void +unlink_notifier_socket(void) +{ +uschar * s = expand_string(notifier_socket); +DEBUG(D_any) debug_printf("unlinking notifier socket %s\n", s); +Uunlink(s); +} +#endif + + static void close_daemon_sockets(int daemon_notifier_fd, int * listen_sockets, int listen_socket_count) { -if (daemon_notifier_fd >= 0) (void) close(daemon_notifier_fd); +if (daemon_notifier_fd >= 0) + { + (void) close(daemon_notifier_fd); + daemon_notifier_fd = -1; +#ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS + unlink_notifier_socket(); +#endif + } + for (int i = 0; i < listen_socket_count; i++) (void) close(listen_sockets[i]); } @@ -963,6 +982,7 @@ daemon_die(void) { int pid; +DEBUG(D_any) debug_printf("SIGTERM seen\n"); #if !defined(DISABLE_TLS) && (defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT)) tls_watch_invalidate(); #endif @@ -972,11 +992,7 @@ if (daemon_notifier_fd >= 0) close(daemon_notifier_fd); daemon_notifier_fd = -1; #ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS - { - uschar * s = expand_string(notifier_socket); - DEBUG(D_any) debug_printf("unlinking notifier socket %s\n", s); - Uunlink(s); - } + unlink_notifier_socket(); #endif } |