From 65e6a29abd7413e21cc45470561e0eee2b24549e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 26 Oct 2020 09:33:06 +0000 Subject: Prepare for 2.9.2.1; add dangling symlink support --- src/libs6/s6_svc_lock_take.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libs6/s6_svc_lock_take.c') diff --git a/src/libs6/s6_svc_lock_take.c b/src/libs6/s6_svc_lock_take.c index 3dec282..a98aeab 100644 --- a/src/libs6/s6_svc_lock_take.c +++ b/src/libs6/s6_svc_lock_take.c @@ -6,6 +6,8 @@ #include #include + /* XXX: does not work with dangling S6_SUPERVISE_CTLDIR symlinks */ + int s6_svc_lock_take (char const *dir) { size_t dirlen = strlen(dir) ; @@ -15,9 +17,9 @@ int s6_svc_lock_take (char const *dir) memcpy(lock + dirlen, "/" S6_SUPERVISE_CTLDIR, sizeof(S6_SUPERVISE_CTLDIR) + 1) ; if ((mkdir(lock, S_IRWXU) < 0) && (errno != EEXIST)) return -1 ; memcpy(lock + dirlen + sizeof(S6_SUPERVISE_CTLDIR), "/lock", 6) ; - fdlock = open_create(lock) ; + fdlock = open_createcoe(lock) ; if (fdlock < 0) return -1 ; - if (coe(fdlock) < 0 || lock_ex(fdlock) < 0) + if (lock_ex(fdlock) < 0) { fd_close(fdlock) ; return -1 ; -- cgit v1.2.3