syslogd: daemonize _after_ init (so that init errors are visible, if they occur)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
02378ce20c
commit
373f64eef3
1 changed files with 8 additions and 8 deletions
|
@ -1055,6 +1055,14 @@ static int NOINLINE syslogd_init(char **argv)
|
||||||
G.hostname = safe_gethostname();
|
G.hostname = safe_gethostname();
|
||||||
*strchrnul(G.hostname, '.') = '\0';
|
*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)) {
|
if (!(opts & OPT_nofork)) {
|
||||||
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
|
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
|
||||||
}
|
}
|
||||||
|
@ -1068,14 +1076,6 @@ static int NOINLINE syslogd_init(char **argv)
|
||||||
signal(SIGALRM, do_mark);
|
signal(SIGALRM, do_mark);
|
||||||
alarm(G.markInterval);
|
alarm(G.markInterval);
|
||||||
#endif
|
#endif
|
||||||
xmove_fd(create_socket(), STDIN_FILENO);
|
|
||||||
|
|
||||||
if (opts & OPT_circularlog)
|
|
||||||
ipcsyslog_init();
|
|
||||||
|
|
||||||
if (opts & OPT_kmsg)
|
|
||||||
kmsg_init();
|
|
||||||
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue