[git commit] syslogd: daemonize _after_ init (so that init errors are visible, if they occur)
Denys Vlasenko
vda.linux at googlemail.com
Tue Jun 13 14:25:13 UTC 2023
commit: https://git.busybox.net/busybox/commit/?id=373f64eef3cc121d7531522ef654feb0a8068d5a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
sysklogd/syslogd.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 20034e969..7711e467b 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -1055,6 +1055,14 @@ static int NOINLINE syslogd_init(char **argv)
G.hostname = safe_gethostname();
*strchrnul(G.hostname, '.') = '\0';
+ xmove_fd(create_socket(), STDIN_FILENO);
+
+ if (opts & OPT_circularlog)
+ ipcsyslog_init();
+
+ if (opts & OPT_kmsg)
+ kmsg_init();
+
if (!(opts & OPT_nofork)) {
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
}
@@ -1068,14 +1076,6 @@ static int NOINLINE syslogd_init(char **argv)
signal(SIGALRM, do_mark);
alarm(G.markInterval);
#endif
- xmove_fd(create_socket(), STDIN_FILENO);
-
- if (opts & OPT_circularlog)
- ipcsyslog_init();
-
- if (opts & OPT_kmsg)
- kmsg_init();
-
return opts;
}
More information about the busybox-cvs
mailing list