[PATCH] syslogd: unlink _PATH_LOG when exiting if not in systemd

Chen Qi Qi.Chen at windriver.com
Mon Sep 29 08:02:27 UTC 2014


If the /dev/log is created by syslogd daemon, then we need to unlink
it when the daemon exists.

If /dev/log is created by systemd, then systemd is responsible for
it, hence there's no need to unlink it in syslogd.

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
---
 sysklogd/syslogd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 266657f..fb35cc7 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -998,6 +998,8 @@ static void do_syslogd(void)
 	ipcsyslog_cleanup();
 	if (option_mask32 & OPT_kmsg)
 		kmsg_cleanup();
+	if (!(sd_listen_fds() == 1))
+		unlink(_PATH_LOG);
 	kill_myself_with_sig(bb_got_signal);
 #undef recvbuf
 }
-- 
1.9.1



More information about the busybox mailing list