]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Use the close_on_exec function here.
authorRoy Marples <roy@marples.name>
Fri, 28 Mar 2008 11:54:29 +0000 (11:54 +0000)
committerRoy Marples <roy@marples.name>
Fri, 28 Mar 2008 11:54:29 +0000 (11:54 +0000)
dhcpcd.c

index 56865860e86289c1be2d59e0a6d12714531f2fac..826c9e940fdd2f5fb8ae3536532eed1cc3c215b4 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -34,7 +34,6 @@ const char copyright[] = "Copyright (c) 2006-2008 Roy Marples";
 #include <arpa/inet.h>
 
 #include <errno.h>
-#include <fcntl.h>
 #include <getopt.h>
 #include <paths.h>
 #include <signal.h>
@@ -617,11 +616,7 @@ main(int argc, char **argv)
                        goto abort;
                }
 
-               /* dhcpcd.sh should not interhit this fd */
-               if ((i = fcntl(pidfd, F_GETFD, 0)) == -1 ||
-                   fcntl(pidfd, F_SETFD, i | FD_CLOEXEC) == -1)
-                       logger(LOG_ERR, "fcntl: %s", strerror(errno));
-
+               close_on_exec(pidfd);
                writepid(pidfd, getpid());
                logger(LOG_INFO, PACKAGE " " VERSION " starting");
        }