diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs6rc/s6rc_lock.c | 7 | ||||
-rw-r--r-- | src/s6-rc/s6-rc-oneshot-run.c | 3 |
2 files changed, 8 insertions, 2 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 ; diff --git a/src/s6-rc/s6-rc-oneshot-run.c b/src/s6-rc/s6-rc-oneshot-run.c index 6973ab9..9b48a33 100644 --- a/src/s6-rc/s6-rc-oneshot-run.c +++ b/src/s6-rc/s6-rc-oneshot-run.c @@ -3,6 +3,7 @@ #include <string.h> #include <strings.h> #include <stdint.h> +#include <unistd.h> #include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> @@ -86,7 +87,7 @@ int main (int argc, char const *const *argv, char const *const *envp) r = s6rc_db_read(fdcompiled, &db) ; if (r < 0) strerr_diefu3sys(111, "read ", compiled, "/db") ; if (!r) strerr_dief3x(4, "invalid service database in ", compiled, "/db") ; - + close(fdcompiled) ; /* Run the script */ |