From d8872c43b48eae5501998a4e5a84337017d8fbe6 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 31 May 2014 12:33:24 -0500 Subject: Introduce xfork() and make commands use it, and make some WEXITSTATUS() use WIFEXITED() and WTERMSIG()+127. --- toys/pending/dhcp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'toys/pending/dhcp.c') diff --git a/toys/pending/dhcp.c b/toys/pending/dhcp.c index 2b432cb3..636746da 100644 --- a/toys/pending/dhcp.c +++ b/toys/pending/dhcp.c @@ -318,10 +318,8 @@ static int dhcp_daemon(void) { int fd = open("/dev/null", O_RDWR); if (fd < 0) fd = xcreate("/", O_RDONLY, 0666); - pid_t pid = fork(); - if (pid < 0) perror_exit("DAEMON: failed to fork"); - if (pid) exit(EXIT_SUCCESS); + if (xfork()) exit(0); setsid(); dup2(fd, 0); -- cgit v1.2.3