diff options
author | Rob Landley <rob@landley.net> | 2014-07-20 21:34:49 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-07-20 21:34:49 -0500 |
commit | 4a86c8193bf05646cdca9faa5253c607d6df5d35 (patch) | |
tree | 3f37fb7e4febb3858171312c0a83081e15340b17 /toys | |
parent | 8fb779954829f923ee2935d81cd4446973aaa01f (diff) | |
download | toybox-4a86c8193bf05646cdca9faa5253c607d6df5d35.tar.gz |
Isaac Dunham spotted that dhcp was also reimplementing daemon().
Diffstat (limited to 'toys')
-rw-r--r-- | toys/pending/dhcp.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/toys/pending/dhcp.c b/toys/pending/dhcp.c index 636746da..bdaefcaa 100644 --- a/toys/pending/dhcp.c +++ b/toys/pending/dhcp.c @@ -314,22 +314,6 @@ static int get_interface( char *interface, int *ifindex, uint32_t *oip, uint8_t return 0; } -static int dhcp_daemon(void) -{ - int fd = open("/dev/null", O_RDWR); - if (fd < 0) fd = xcreate("/", O_RDONLY, 0666); - - if (xfork()) exit(0); - - setsid(); - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - if (fd > 2) xclose(fd); - - return 0; -} - /* *logs messeges to syslog or console *opening the log is still left with applet. @@ -1368,7 +1352,7 @@ lease_fail: } if (flag_chk(FLAG_b)) { infomsg(infomode, "Lease failed. Going Daemon mode"); - dhcp_daemon(); + daemon(0, 0); if (flag_chk(FLAG_p)) write_pid(TT.pidfile); toys.optflags &= ~FLAG_b; toys.optflags |= FLAG_f; @@ -1505,7 +1489,7 @@ renew_requested: } toys.optflags &= ~FLAG_n; if (!flag_chk(FLAG_f)) { - dhcp_daemon(); + daemon(0, 0); toys.optflags |= FLAG_f; if (flag_chk(FLAG_p)) write_pid(TT.pidfile); } |