aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:20:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:20:54 +0000
commit5a142025d372ae5dff7d7cf98f442edaafd1dc30 (patch)
tree19d222f7d7040945cf92e239055dfdd00b8656bc /networking
parentbb7fcb4229fd5ff583039f26ca1c06340e3f09ea (diff)
downloadbusybox-5a142025d372ae5dff7d7cf98f442edaafd1dc30.tar.gz
move everything to new NOMMU helpers, except udhcp
Diffstat (limited to 'networking')
-rw-r--r--networking/dnsd.c7
-rw-r--r--networking/httpd.c2
-rw-r--r--networking/inetd.c28
-rw-r--r--networking/isrv_identd.c4
-rw-r--r--networking/telnetd.c2
-rw-r--r--networking/zcip.c3
6 files changed, 18 insertions, 28 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c
index c9c7b3a7c..8807bbedc 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -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;
}
diff --git a/networking/httpd.c b/networking/httpd.c
index 72b03de79..b8d9b6b6f 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -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);
}
diff --git a/networking/inetd.c b/networking/inetd.c
index 83123463f..4faa4203a 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -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;
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index f9ab0b2c0..c230c7ec3 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -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
diff --git a/networking/telnetd.c b/networking/telnetd.c
index ef9b1ac74..5c0463bab 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -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();
diff --git a/networking/zcip.c b/networking/zcip.c
index c50d5abaf..c0cf665dd 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -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);
}