diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-13 16:25:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-13 16:25:13 +0200 |
commit | 373f64eef3cc121d7531522ef654feb0a8068d5a (patch) | |
tree | 92ac829cd828020a3e9dcabbb0b64862cf532bb9 | |
parent | 02378ce20c6d2df062357b6d60fc440609d203be (diff) | |
download | busybox-w32-373f64eef3cc121d7531522ef654feb0a8068d5a.tar.gz busybox-w32-373f64eef3cc121d7531522ef654feb0a8068d5a.tar.bz2 busybox-w32-373f64eef3cc121d7531522ef654feb0a8068d5a.zip |
syslogd: daemonize _after_ init (so that init errors are visible, if they occur)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | sysklogd/syslogd.c | 16 |
1 files 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) | |||
1055 | G.hostname = safe_gethostname(); | 1055 | G.hostname = safe_gethostname(); |
1056 | *strchrnul(G.hostname, '.') = '\0'; | 1056 | *strchrnul(G.hostname, '.') = '\0'; |
1057 | 1057 | ||
1058 | xmove_fd(create_socket(), STDIN_FILENO); | ||
1059 | |||
1060 | if (opts & OPT_circularlog) | ||
1061 | ipcsyslog_init(); | ||
1062 | |||
1063 | if (opts & OPT_kmsg) | ||
1064 | kmsg_init(); | ||
1065 | |||
1058 | if (!(opts & OPT_nofork)) { | 1066 | if (!(opts & OPT_nofork)) { |
1059 | bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); | 1067 | bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); |
1060 | } | 1068 | } |
@@ -1068,14 +1076,6 @@ static int NOINLINE syslogd_init(char **argv) | |||
1068 | signal(SIGALRM, do_mark); | 1076 | signal(SIGALRM, do_mark); |
1069 | alarm(G.markInterval); | 1077 | alarm(G.markInterval); |
1070 | #endif | 1078 | #endif |
1071 | xmove_fd(create_socket(), STDIN_FILENO); | ||
1072 | |||
1073 | if (opts & OPT_circularlog) | ||
1074 | ipcsyslog_init(); | ||
1075 | |||
1076 | if (opts & OPT_kmsg) | ||
1077 | kmsg_init(); | ||
1078 | |||
1079 | return opts; | 1079 | return opts; |
1080 | } | 1080 | } |
1081 | 1081 | ||