diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-08-31 23:33:28 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-08-31 23:33:28 +0000 |
commit | 6d1c11fdbb384e7606ea7fd69ee2044cf448b2ae (patch) | |
tree | 39e8cdc7eef1b886ac58941df6ff6694e1c92801 /src | |
parent | bbcb30749d3b6dc5e97a7b545999fab13b554dc4 (diff) | |
download | s6-6d1c11fdbb384e7606ea7fd69ee2044cf448b2ae.tar.xz |
Remove race conditions in early services with this ONE SIMPLE TRICK
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/supervision/s6_svlisten_loop.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c index c97427f..3a89a9c 100644 --- a/src/supervision/s6_svlisten_loop.c +++ b/src/supervision/s6_svlisten_loop.c @@ -1,18 +1,23 @@ /* ISC license. */ #include <string.h> +#include <unistd.h> + #include <skalibs/bytestr.h> #include <skalibs/bitarray.h> #include <skalibs/strerr2.h> #include <skalibs/iopause.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> + +#include <s6/ftrigw.h> #include <s6/ftrigr.h> #include <s6/supervise.h> #include "s6-svlisten.h" void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16_t *ids, unsigned char *upstate, unsigned char *readystate, tain const *deadline) { + gid_t gid = getegid() ; unsigned int i = 0 ; foo->n = (unsigned int)argc ; foo->ids = ids ; @@ -27,6 +32,7 @@ void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, ui memcpy(s, argv[i], len) ; s[len] = '/' ; memcpy(s + len + 1, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ; + ftrigw_fifodir_make(s, gid, 0) ; foo->ids[i] = ftrigr_subscribe_g(&foo->a, s, "[DuUdOx]", FTRIGR_REPEAT, deadline) ; if (!foo->ids[i]) strerr_diefu2sys(111, "subscribe to events for ", argv[i]) ; if (!s6_svstatus_read(argv[i], &status)) strerr_diefu1sys(111, "s6_svstatus_read") ; |