aboutsummaryrefslogtreecommitdiff
path: root/networking/inetd.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/inetd.c')
-rw-r--r--networking/inetd.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/networking/inetd.c b/networking/inetd.c
index 93c16bf60..f9f3b51b6 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1289,31 +1289,28 @@ inetd_main(int argc, char *argv[])
1289 if (CONFIG == NULL) 1289 if (CONFIG == NULL)
1290 bb_error_msg_and_die("non-root must specify a config file"); 1290 bb_error_msg_and_die("non-root must specify a config file");
1291 1291
1292 if (!(opt & 2)) {
1293#ifdef BB_NOMMU 1292#ifdef BB_NOMMU
1293 if (!(opt & 2)) {
1294 /* reexec for vfork() do continue parent */ 1294 /* reexec for vfork() do continue parent */
1295 vfork_daemon_rexec(0, 0, argc, argv, "-f"); 1295 vfork_daemon_rexec(0, 0, argc, argv, "-f");
1296 }
1297 bb_sanitize_stdio(0);
1296#else 1298#else
1297 xdaemon(0, 0); 1299 bb_sanitize_stdio(!(opt & 2));
1298#endif 1300#endif
1299 } else {
1300 setsid();
1301 }
1302 logmode = LOGMODE_SYSLOG; 1301 logmode = LOGMODE_SYSLOG;
1303 1302
1304 if (uid == 0) { 1303 if (uid == 0) {
1305 gid_t gid = getgid();
1306
1307 /* If run by hand, ensure groups vector gets trashed */ 1304 /* If run by hand, ensure groups vector gets trashed */
1305 gid_t gid = getgid();
1308 setgroups(1, &gid); 1306 setgroups(1, &gid);
1309 } 1307 }
1310 1308
1311 { 1309 {
1312 FILE *fp = fopen(_PATH_INETDPID, "w"); 1310 FILE *fp = fopen(_PATH_INETDPID, "w");
1313
1314 if (fp != NULL) { 1311 if (fp != NULL) {
1315 fprintf(fp, "%u\n", getpid()); 1312 fprintf(fp, "%u\n", getpid());
1316 (void) fclose(fp); 1313 fclose(fp);
1317 } 1314 }
1318 } 1315 }
1319 1316