diff options
| author | Roy Marples <roy@marples.name> | 2016-05-04 12:32:29 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2016-05-04 12:32:29 +0000 |
| commit | 1a8679adbc0dc118674c47e872bb241921a0ba7b (patch) | |
| tree | 5b6f43773a0f07e1038a91a7a6a3515a6125476c /compat | |
| parent | e93ffab1620e36c34442e08cf5a9e27e22eb5f72 (diff) | |
| download | dhcpcd-1a8679adbc0dc118674c47e872bb241921a0ba7b.tar.xz | |
Fix returning a pid if open fails.
Diffstat (limited to 'compat')
| -rw-r--r-- | compat/pidfile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compat/pidfile.c b/compat/pidfile.c index 10cbd109..20302c29 100644 --- a/compat/pidfile.c +++ b/compat/pidfile.c @@ -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; |
