commit 025e5ed74528cc2e8676268ad07b169949d89ae3
parent c9cbf322db9b0617e38859b08e9ea90976bd6fcd
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Sat, 13 Feb 2021 01:24:32 +0000
bugfix: ipc_bind_reuse_lock must ignore umask
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/libstddjb/ipc_bind_reuse_lock.c b/src/libstddjb/ipc_bind_reuse_lock.c
@@ -2,6 +2,7 @@
#include <skalibs/nonposix.h>
+#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -19,7 +20,7 @@ int ipc_bind_reuse_lock (int s, char const *p, int *fdlock)
char lockname[len + 6] ;
memcpy(lockname, p, len) ;
memcpy(lockname + len, ".lock", 6) ;
- fd = openc_create(lockname) ;
+ fd = open3(lockname, O_WRONLY | O_NONBLOCK | O_CREAT | O_CLOEXEC, 0600) ;
if (fd < 0) return -1 ;
r = fd_lock(fd, 1, 1) ;
if (r < 0) return -1 ;