Daemonize after applying configuration, not before, so that
any problems - including "daemon already running" - are visible on the terminal and not just in logs. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
017cbe4aaa
commit
5d5a95f138
@ -1644,14 +1644,6 @@ main(int argc, char **argv)
|
|||||||
newconf->conf_debug = debug;
|
newconf->conf_debug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dont_daemonize == false) {
|
|
||||||
if (daemon(0, 0) == -1) {
|
|
||||||
log_warn("cannot daemonize");
|
|
||||||
pidfile_remove(newconf->conf_pidfh);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ICL_KERNEL_PROXY
|
#ifdef ICL_KERNEL_PROXY
|
||||||
log_debugx("enabling CTL iSCSI port");
|
log_debugx("enabling CTL iSCSI port");
|
||||||
error = kernel_port_on();
|
error = kernel_port_on();
|
||||||
@ -1674,6 +1666,15 @@ main(int argc, char **argv)
|
|||||||
log_errx(1, "failed to enable CTL iSCSI port, exiting");
|
log_errx(1, "failed to enable CTL iSCSI port, exiting");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (dont_daemonize == false) {
|
||||||
|
log_debugx("daemonizing");
|
||||||
|
if (daemon(0, 0) == -1) {
|
||||||
|
log_warn("cannot daemonize");
|
||||||
|
pidfile_remove(newconf->conf_pidfh);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
main_loop(newconf, dont_daemonize);
|
main_loop(newconf, dont_daemonize);
|
||||||
if (sighup_received) {
|
if (sighup_received) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user