From: Jeremy Harris Date: Sat, 6 Feb 2021 17:30:37 +0000 (+0000) Subject: Fix daemon-SIGHUP on FreeBSD X-Git-Tag: exim-4.94.1~65 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/c4e2500b1d629e640a40f15889c5dc39ca3d116b?ds=inline Fix daemon-SIGHUP on FreeBSD Cherry-picked from: beb5d85c7d --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index b7e310f04..c9ad2e259 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -142,6 +142,14 @@ JH/39 Bug 2691: fix $local_part_data. When the matching list element referred to a file, bad data was returned. This likely also affected $domain_part_data. +JH/41 Fix daemon SIGHUP on FreeBSD. Previously, a named socket for IPC was + left undeleted; the attempt to re-create it then failed - resulting in + the usual "SIGHUP tp have daemon reload configuration" to not work. + This affected any platform not supporting "abstract" Unix-domain + sockets (i.e. not Linux). + + + Exim version 4.94 ----------------- diff --git a/src/src/daemon.c b/src/src/daemon.c index 9d491593f..ca3dd2cf1 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -130,11 +130,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]); } @@ -972,11 +991,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 }