diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-05-12 23:15:59 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-05-12 23:15:59 +0000 |
commit | 7b1b1772f0a242d0975581e9225723f262a7a5f7 (patch) | |
tree | 7a059dcd3f7ceeb44f54c9451049fc596ea63576 /src/libs6rc | |
parent | f42bff4c9dc8374205e3581df1ce72fca972dcd1 (diff) | |
download | s6-rc-7b1b1772f0a242d0975581e9225723f262a7a5f7.tar.xz |
bugfixes: fd leak in s6-rc-oneshot-run, and missing coe in s6rc_lock
Diffstat (limited to 'src/libs6rc')
-rw-r--r-- | src/libs6rc/s6rc_lock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libs6rc/s6rc_lock.c b/src/libs6rc/s6rc_lock.c index 2a623d0..43b60bb 100644 --- a/src/libs6rc/s6rc_lock.c +++ b/src/libs6rc/s6rc_lock.c @@ -28,6 +28,7 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int memcpy(lfn + llen, "/lock", 6) ; lfd = open_create(lfn) ; if (lfd < 0) return 0 ; + if (coe(lfd) < 0) { e = errno ; goto lerr ; } if ((lwhat > 1 ? lockex(lfd, blocking) : locksh(lfd, blocking)) < 0) { e = errno ; goto lerr ; } } @@ -41,7 +42,11 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int if (cfd < 0) if (cwhat > 1 || errno != EROFS) { e = errno ; goto lerr ; } else cfd = -errno ; - else if ((cwhat > 1 ? lockex(cfd, blocking) : locksh(cfd, blocking)) < 0) { e = errno ; goto cerr ; } + else + { + if (coe(cfd) < 0) { e = errno ; goto cerr ; } + if ((cwhat > 1 ? lockex(cfd, blocking) : locksh(cfd, blocking)) < 0) { e = errno ; goto cerr ; } + } } if (lwhat) *llfd = lfd ; |