move everything to new NOMMU helpers, except udhcp
This commit is contained in:
@@ -353,12 +353,7 @@ int dnsd_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (OPT_daemon) {
|
||||
#ifdef BB_NOMMU
|
||||
if (!re_execed)
|
||||
vfork_daemon_rexec(1, 0, argv);
|
||||
#else
|
||||
xdaemon(1, 0);
|
||||
#endif
|
||||
bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS, argv);
|
||||
openlog(applet_name, LOG_PID, LOG_DAEMON);
|
||||
logmode = LOGMODE_SYSLOG;
|
||||
}
|
||||
|
@@ -2044,6 +2044,6 @@ int httpd_main(int argc, char *argv[])
|
||||
return miniHttpd_inetd();
|
||||
|
||||
if (!(opt & OPT_FOREGROUND))
|
||||
xdaemon(1, 0); /* don't change current directory */
|
||||
bb_daemonize(0); /* don't change current directory */
|
||||
return miniHttpd(config->server_socket);
|
||||
}
|
||||
|
@@ -1274,30 +1274,24 @@ int inetd_main(int argc, char *argv[])
|
||||
LastArg = envp[-1] + strlen(envp[-1]);
|
||||
#endif
|
||||
|
||||
opt = getopt32(argc, argv, "R:f", &stoomany);
|
||||
if(opt & 1) {
|
||||
toomany = xatoi_u(stoomany);
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
uid = getuid();
|
||||
if (uid != 0)
|
||||
config_filename = NULL;
|
||||
if (argc > 0)
|
||||
|
||||
opt = getopt32(argc, argv, "R:f", &stoomany);
|
||||
if (opt & 1)
|
||||
toomany = xatoi_u(stoomany);
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
if (argc)
|
||||
config_filename = argv[0];
|
||||
if (config_filename == NULL)
|
||||
bb_error_msg_and_die("non-root must specify a config file");
|
||||
|
||||
#ifdef BB_NOMMU
|
||||
if (!(opt & 2)) {
|
||||
if (!re_execed)
|
||||
vfork_daemon_rexec(0, 0, argv);
|
||||
}
|
||||
bb_sanitize_stdio();
|
||||
#else
|
||||
bb_sanitize_stdio_maybe_daemonize(!(opt & 2));
|
||||
#endif
|
||||
if (!(opt & 2))
|
||||
bb_daemonize_or_rexec(0, argv - optind);
|
||||
else
|
||||
bb_sanitize_stdio();
|
||||
openlog(applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
|
||||
logmode = LOGMODE_SYSLOG;
|
||||
|
||||
|
@@ -112,7 +112,9 @@ int fakeidentd_main(int argc, char **argv)
|
||||
bogouser = argv[optind];
|
||||
|
||||
/* Daemonize if no -f and no -i and no -w */
|
||||
bb_sanitize_stdio_maybe_daemonize(!(opt & OPT_fiw));
|
||||
if (!(opt & OPT_fiw));
|
||||
bb_daemonize_or_rexec(0, argv);
|
||||
|
||||
/* Where to log in inetd modes? "Classic" inetd
|
||||
* probably has its stderr /dev/null'ed (we need log to syslog?),
|
||||
* but daemontools-like utilities usually expect that children
|
||||
|
@@ -415,7 +415,7 @@ int telnetd_main(int argc, char **argv)
|
||||
master_fd = create_and_bind_stream_or_die(opt_bindaddr, portnbr);
|
||||
xlisten(master_fd, 1);
|
||||
if (!(opt & OPT_FOREGROUND))
|
||||
xdaemon(0, 0);
|
||||
bb_daemonize(DAEMON_CHDIR_ROOT);
|
||||
}
|
||||
#else
|
||||
sessions = make_new_session();
|
||||
|
@@ -271,9 +271,8 @@ int zcip_main(int argc, char *argv[])
|
||||
|
||||
// daemonize now; don't delay system startup
|
||||
if (!FOREGROUND) {
|
||||
/* bb_daemonize(); - bad, will close fd! */
|
||||
//NOMMU
|
||||
xdaemon(0, 0);
|
||||
bb_daemonize(DAEMON_CHDIR_ROOT);
|
||||
bb_info_msg("start, interface %s", intf);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user