[git commit] syslogd: delay PID file creation until syslogd is ready

Denys Vlasenko vda.linux at googlemail.com
Mon Nov 16 11:12:04 UTC 2020


commit: https://git.busybox.net/busybox/commit/?id=efe99b59c6cd3d9de91ebfc39f9870b8708e5b92
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

This patch moves the creation of the PID file until after syslogd has
set up signal handlers and is ready.

Signed-off-by: Joachim Nilsson <troglobit at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 sysklogd/syslogd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index f61da9de5..598f28d0c 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -1034,6 +1034,7 @@ static void do_syslogd(void)
 		kmsg_init();
 
 	timestamp_and_log_internal("syslogd started: BusyBox v" BB_VER);
+	write_pidfile_std_path_and_ext("syslogd");
 
 	while (!bb_got_signal) {
 		ssize_t sz;
@@ -1182,9 +1183,6 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
 		bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
 	}
 
-	//umask(0); - why??
-	write_pidfile_std_path_and_ext("syslogd");
-
 	do_syslogd();
 	/* return EXIT_SUCCESS; */
 }


More information about the busybox-cvs mailing list