diff options
-rw-r--r-- | src/include/s6/s6-supervise.h | 2 | ||||
-rw-r--r-- | src/libs6/s6_supervise_link.c | 22 | ||||
-rw-r--r-- | src/libs6/s6_supervise_unlink.c | 20 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/include/s6/s6-supervise.h b/src/include/s6/s6-supervise.h index 77280e7..6c382d1 100644 --- a/src/include/s6/s6-supervise.h +++ b/src/include/s6/s6-supervise.h @@ -56,7 +56,7 @@ extern int s6_svstatus_read (char const *, s6_svstatus_t *) ; extern int s6_svstatus_write (char const *, s6_svstatus_t const *) ; extern int s6_supervise_link (char const *, char const *const *, size_t, char const *, uint32_t, tain_t const *, tain_t *) ; -#define s6_supervise_link_g(scandir, servicedirs, n, prefix, options, deadline) s6_supervise_link(scandir, servicedirs, n, prefix, options, (deadline), &STAMP) +#define s6_supervise_link_g(scdir, servicedirs, n, prefix, options, deadline) s6_supervise_link(scdir, servicedirs, n, prefix, options, (deadline), &STAMP) extern void s6_supervise_unlink (char const *, char const *, uint32_t) ; typedef struct s6_dtally_s s6_dtally_t, *s6_dtally_ref ; diff --git a/src/libs6/s6_supervise_link.c b/src/libs6/s6_supervise_link.c index 7d97f4a..118d66c 100644 --- a/src/libs6/s6_supervise_link.c +++ b/src/libs6/s6_supervise_link.c @@ -16,7 +16,7 @@ #include <s6/ftrigw.h> #include <s6/s6-supervise.h> -static inline void do_unlink (char const *scandir, char const *prefix, size_t prefixlen, size_t maxlen, char const *names, size_t nameslen, uint32_t killopts) +static inline void do_unlink (char const *scdir, char const *prefix, size_t prefixlen, size_t maxlen, char const *names, size_t nameslen, uint32_t killopts) { char fn[prefixlen + maxlen + 1] ; memcpy(fn, prefix, prefixlen) ; @@ -24,12 +24,12 @@ static inline void do_unlink (char const *scandir, char const *prefix, size_t pr { size_t len = strlen(names) + 1 ; memcpy(fn + prefixlen, names, len) ; - s6_supervise_unlink(scandir, fn, killopts) ; + s6_supervise_unlink(scdir, fn, killopts) ; names += len ; nameslen -= len ; } } -int s6_supervise_link (char const *scandir, char const *const *servicedirs, size_t n, char const *prefix, uint32_t options, tain_t const *deadline, tain_t *stamp) +int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t n, char const *prefix, uint32_t options, tain_t const *deadline, tain_t *stamp) { size_t maxlen = 0 ; size_t ntotal = n ; @@ -72,7 +72,7 @@ int s6_supervise_link (char const *scandir, char const *const *servicedirs, size stralloc rpsa = STRALLOC_ZERO ; stralloc lnames = STRALLOC_ZERO ; gid_t gid = options & 2 ? -1 : getegid() ; - size_t scandirlen = strlen(scandir) ; + size_t scdirlen = strlen(scdir) ; size_t prefixlen = strlen(prefix) ; unsigned int m = 0 ; size_t i = 0 ; @@ -80,12 +80,12 @@ int s6_supervise_link (char const *scandir, char const *const *servicedirs, size uint32_t killopts = 0 ; int r ; uint16_t ids[ntotal] ; - char lname[scandirlen + prefixlen + maxlen + 2] ; + char lname[scdirlen + prefixlen + maxlen + 2] ; char fn[maxlen + 5 + sizeof(S6_SUPERVISE_EVENTDIR)] ; if (!ftrigr_startf(&a, deadline, stamp)) return -1 ; - memcpy(lname, scandir, scandirlen) ; - lname[scandirlen] = '/' ; - memcpy(lname + scandirlen + 1, prefix, prefixlen) ; + memcpy(lname, scdir, scdirlen) ; + lname[scdirlen] = '/' ; + memcpy(lname + scdirlen + 1, prefix, prefixlen) ; for (i = 0 ; i < n ; i++) if (!bitarray_peek(locked, i)) { char *p ; @@ -106,7 +106,7 @@ int s6_supervise_link (char const *scandir, char const *const *servicedirs, size fn[len] = 0 ; p = basename(fn) ; len = strlen(p) ; - memcpy(lname + scandirlen + 1 + prefixlen, p, len + 1) ; + memcpy(lname + scdirlen + 1 + prefixlen, p, len + 1) ; rpsa.len = 0 ; lstart = lnames.len ; if (!sarealpath(&rpsa, servicedirs[i]) || !stralloc_0(&rpsa)) goto err ; @@ -114,7 +114,7 @@ int s6_supervise_link (char const *scandir, char const *const *servicedirs, size if (symlink(rpsa.s, lname) < 0) goto errl ; } stralloc_free(&rpsa) ; - r = s6_svc_writectl(scandir, S6_SVSCAN_CTLDIR, "a", 1) ; + r = s6_svc_writectl(scdir, S6_SVSCAN_CTLDIR, "a", 1) ; if (r <= 0) goto errsa ; killopts = 3 ; if (ftrigr_wait_and(&a, ids, m, deadline, stamp) < 0) goto errsa ; @@ -128,7 +128,7 @@ int s6_supervise_link (char const *scandir, char const *const *servicedirs, size stralloc_free(&rpsa) ; errsa: ftrigr_end(&a) ; - do_unlink(scandir, prefix, prefixlen, maxlen, lnames.s, lnames.len, killopts) ; + do_unlink(scdir, prefix, prefixlen, maxlen, lnames.s, lnames.len, killopts) ; stralloc_free(&lnames) ; return -1 ; } diff --git a/src/libs6/s6_supervise_unlink.c b/src/libs6/s6_supervise_unlink.c index d4bbe73..36d765b 100644 --- a/src/libs6/s6_supervise_unlink.c +++ b/src/libs6/s6_supervise_unlink.c @@ -17,24 +17,24 @@ # define S6_PATH_MAX 4096 #endif -void s6_supervise_unlink (char const *scandir, char const *name, uint32_t options) +void s6_supervise_unlink (char const *scdir, char const *name, uint32_t options) { int e = errno ; int fd = -1 ; - size_t scandirlen = strlen(scandir) ; + size_t scdirlen = strlen(scdir) ; size_t namelen = strlen(name) ; - char fn[scandirlen + namelen + sizeof(S6_SUPERVISE_CTLDIR) + 10] ; - memcpy(fn, scandir, scandirlen) ; - fn[scandirlen] = '/' ; - memcpy(fn + scandirlen + 1, name, namelen) ; + char fn[scdirlen + namelen + sizeof(S6_SUPERVISE_CTLDIR) + 10] ; + memcpy(fn, scdir, scdirlen) ; + fn[scdirlen] = '/' ; + memcpy(fn + scdirlen + 1, name, namelen) ; if (options & 1) { - fn[scandirlen + 1 + namelen] = '/' ; - memcpy(fn + scandirlen + 1 + namelen + 1, S6_SUPERVISE_CTLDIR, sizeof(S6_SUPERVISE_CTLDIR) - 1) ; - memcpy(fn + scandirlen + 1 + namelen + sizeof(S6_SUPERVISE_CTLDIR), "/control", 9) ; + fn[scdirlen + 1 + namelen] = '/' ; + memcpy(fn + scdirlen + 1 + namelen + 1, S6_SUPERVISE_CTLDIR, sizeof(S6_SUPERVISE_CTLDIR) - 1) ; + memcpy(fn + scdirlen + 1 + namelen + sizeof(S6_SUPERVISE_CTLDIR), "/control", 9) ; fd = open_write(fn) ; } - fn[scandirlen + 1 + namelen] = 0 ; + fn[scdirlen + 1 + namelen] = 0 ; unlink_void(fn) ; if (fd >= 0) { |