diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-07-26 13:32:44 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-07-26 13:32:44 +0000 |
commit | b102348e988e4abc5d579ce13c067ce2c885aaf7 (patch) | |
tree | f7df67ce818aa8720f956171765889684c528ee1 /dund/main.c | |
parent | abaf87668c896d8cebcfa1081eec195cd0008740 (diff) |
Fix declared with attribute warn_unused_result errors
Diffstat (limited to 'dund/main.c')
-rw-r--r-- | dund/main.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/dund/main.c b/dund/main.c index 249d6d7c..bb96d639 100644 --- a/dund/main.c +++ b/dund/main.c @@ -598,18 +598,9 @@ int main(int argc, char *argv[]) sa.sa_handler = sig_hup; sigaction(SIGHUP, &sa, NULL); - if (detach) { - int fd; - - if (fork()) exit(0); - - /* Direct stdin,stdout,stderr to '/dev/null' */ - fd = open("/dev/null", O_RDWR); - dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); - close(fd); - - setsid(); - chdir("/"); + if (detach && daemon(0, 0)) { + perror("Can't start daemon"); + exit(1); } openlog("dund", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON); |