summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2021-02-06 17:30:37 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2021-02-06 17:30:37 +0000
commitc4e2500b1d629e640a40f15889c5dc39ca3d116b (patch)
treeffaade45ce0b549be180601d44f61213dc6a7fcb
parenta2d2ad92a8a40307bb29f28f7c47783e436b5db7 (diff)
downloadexim4-c4e2500b1d629e640a40f15889c5dc39ca3d116b.tar.gz
Fix daemon-SIGHUP on FreeBSD
Cherry-picked from: beb5d85c7d
-rw-r--r--doc/doc-txt/ChangeLog8
-rw-r--r--src/src/daemon.c27
2 files changed, 29 insertions, 6 deletions
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
}