]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix returning a pid if open fails.
authorRoy Marples <roy@marples.name>
Wed, 4 May 2016 12:32:29 +0000 (12:32 +0000)
committerRoy Marples <roy@marples.name>
Wed, 4 May 2016 12:32:29 +0000 (12:32 +0000)
compat/pidfile.c

index 10cbd109063e58d972a3ca6d988b8159e94351fc..20302c29bfbf26cc4e9376942bec9b4d17ff67d9 100644 (file)
@@ -205,7 +205,7 @@ pidfile_lock(const char *path)
                opts |= O_EXLOCK;
 #endif
                if ((fd = open(path, opts, 0644)) == -1)
-                       return -1;
+                       goto return_pid;
 #ifndef O_CLOEXEC
                if ((opts = fcntl(fd, F_GETFD)) == -1 ||
                    fctnl(fd, F_SETFL, opts | FD_CLOEXEC) == -1)
@@ -229,6 +229,8 @@ pidfile_lock(const char *path)
                        fd = -1;
                }
 #endif
+
+return_pid:
                if (fd == -1) {
                        pid_t pid;