diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-07 17:55:23 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-07 17:55:23 +0000 |
commit | 0e7b69f1af91ccf288f3e1fd29ea7c65b7f6f986 (patch) | |
tree | 6ad1fb5b87db3d17ed40c30ac9ea6d980fb3c6b0 /src/libs6rc/s6rc_servicedir_unsupervise.c | |
parent | 79cb9644f99f056641f4c145da6e7ca63b333b80 (diff) | |
download | s6-rc-0e7b69f1af91ccf288f3e1fd29ea7c65b7f6f986.tar.xz |
Prepare for 0.5.2.1; build against new skalibs/execline/s6
Diffstat (limited to 'src/libs6rc/s6rc_servicedir_unsupervise.c')
-rw-r--r-- | src/libs6rc/s6rc_servicedir_unsupervise.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/libs6rc/s6rc_servicedir_unsupervise.c b/src/libs6rc/s6rc_servicedir_unsupervise.c index 2d15a70..44cc7b9 100644 --- a/src/libs6rc/s6rc_servicedir_unsupervise.c +++ b/src/libs6rc/s6rc_servicedir_unsupervise.c @@ -1,10 +1,9 @@ /* ISC license. */ -#include <errno.h> #include <string.h> -#include <unistd.h> -#include <skalibs/posixplz.h> + #include <s6/s6-supervise.h> + #include <s6-rc/s6rc-servicedir.h> void s6rc_servicedir_unsupervise (char const *live, char const *prefix, char const *name, int keepsupervisor) @@ -12,18 +11,11 @@ void s6rc_servicedir_unsupervise (char const *live, char const *prefix, char con size_t livelen = strlen(live) ; size_t prefixlen = strlen(prefix) ; size_t namelen = strlen(name) ; - char fn[livelen + 14 + prefixlen + namelen] ; - memcpy(fn, live, livelen) ; - memcpy(fn + livelen, "/scandir/", 9) ; - memcpy(fn + livelen + 9, prefix, prefixlen) ; - memcpy(fn + livelen + 9 + prefixlen, name, namelen + 1) ; - unlink_void(fn) ; - if (!keepsupervisor) - { - int e = errno ; - memcpy(fn + livelen + 1, "servicedirs/", 12) ; - memcpy(fn + livelen + 13, name, namelen + 1) ; - s6_svc_writectl(fn, S6_SUPERVISE_CTLDIR, "x", 1) ; - errno = e ; - } + char scdir[livelen + 9] ; + char fn[prefixlen + namelen + 1] ; + memcpy(scdir, live, livelen) ; + memcpy(scdir + livelen, "/scandir", 9) ; + memcpy(fn, prefix, prefixlen) ; + memcpy(fn + prefixlen, name, namelen + 1) ; + s6_supervise_unlink(scdir, fn, keepsupervisor ? 0 : 3) ; } |