summaryrefslogtreecommitdiff
path: root/src/libs6rc/s6rc_livedir_create.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-02-18 14:52:20 +0000
committerLaurent Bercot <ska@appnovation.com>2023-02-18 14:52:20 +0000
commit97f206f4f692317b2cef99537f550388df95c5db (patch)
tree5c77886be4a6f39e7559707eefa029899b1ad06d /src/libs6rc/s6rc_livedir_create.c
parentc05332c409b2126991104a4e4ad8749ad78c3076 (diff)
downloads6-rc-97f206f4f692317b2cef99537f550388df95c5db.tar.xz
Prepare for 0.5.4.1; ensure livedir always has a lock file
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6rc/s6rc_livedir_create.c')
-rw-r--r--src/libs6rc/s6rc_livedir_create.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libs6rc/s6rc_livedir_create.c b/src/libs6rc/s6rc_livedir_create.c
index bd44bd6..e4056b1 100644
--- a/src/libs6rc/s6rc_livedir_create.c
+++ b/src/libs6rc/s6rc_livedir_create.c
@@ -1,13 +1,16 @@
/* ISC license. */
#include <skalibs/nonposix.h>
+
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
+
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
+
#include <s6-rc/s6rc-utils.h>
int s6rc_livedir_create (stralloc *sa, char const *live, char const *suffix, char const *scdir, char const *prefix, char const *compiled, unsigned char const *state, unsigned int statelen, size_t *dirlen)
@@ -33,6 +36,8 @@ int s6rc_livedir_create (stralloc *sa, char const *live, char const *suffix, cha
if (!openwritenclose_unsafe(sa->s + sabase, prefix, strlen(prefix))) goto delerr ;
strcpy(sa->s + newlen, "state") ;
if (!openwritenclose_unsafe(sa->s + sabase, (char const *)state, statelen)) goto delerr ;
+ strcpy(sa->s + newlen, "lock") ;
+ if (!openwritenclose_unsafe(sa->s + sabase, "", 0)) goto delerr ;
sa->len = newlen-1 ;
sa->s[newlen-1] = 0 ;
*dirlen = ddirlen ;