diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-02 05:24:24 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-02 05:24:24 +0000 |
commit | 8873c303fefaed17f6777989f929612a99675a00 (patch) | |
tree | 26efa9863177ec574d4351e8db84a47566a2af98 /src/daemontools-extras/s6-log.c | |
parent | 2a73901e12a1f3b498e6901ef607b55f9f193097 (diff) | |
download | s6-8873c303fefaed17f6777989f929612a99675a00.tar.xz |
Fix build against skalibs-2.10.0.0
Diffstat (limited to 'src/daemontools-extras/s6-log.c')
-rw-r--r-- | src/daemontools-extras/s6-log.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c index 2f8438d..5128751 100644 --- a/src/daemontools-extras/s6-log.c +++ b/src/daemontools-extras/s6-log.c @@ -580,13 +580,14 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint ldp->fd = -1 ; ldp->rstate = ROTSTATE_WRITABLE ; r = mkdir(ldp->dir, S_IRWXU | S_ISGID) ; - if ((r < 0) && (errno != EEXIST)) strerr_diefu2sys(111, "mkdir ", name) ; + if (r < 0 && errno != EEXIST) strerr_diefu2sys(111, "mkdir ", name) ; memcpy(x, name, dirlen) ; memcpy(x + dirlen, "/lock", 6) ; - ldp->fdlock = open_append(x) ; - if ((ldp->fdlock) < 0) strerr_diefu2sys(111, "open_append ", x) ; - if (lock_exnb(ldp->fdlock) < 0) strerr_diefu2sys(111, "lock_exnb ", x) ; - if (coe(ldp->fdlock) < 0) strerr_diefu2sys(111, "coe ", x) ; + ldp->fdlock = openc_create(x) ; + if (ldp->fdlock < 0) strerr_diefu2sys(111, "open ", x) ; + r = fd_lock(ldp->fdlock, 1, 1) ; + if (!r) errno = EBUSY ; + if (r < 1) strerr_diefu2sys(111, "lock ", x) ; memcpy(x + dirlen + 1, "current", 8) ; if (stat(x, &st) < 0) { |