diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-01-31 11:18:24 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-01-31 11:18:24 +0000 |
commit | aa35510f1003777d309fa345ac373ba1b572c5ce (patch) | |
tree | 164de101c1e63b684df8bc3e4e350ba8b4877926 | |
parent | 230393cd872421d26d37fa19378471a23a8ed466 (diff) | |
download | s6-rc-aa35510f1003777d309fa345ac373ba1b572c5ce.tar.xz |
Don't hard depend on PATH_MAX; change servicedir file list
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | src/libs6rc/s6rc_livedir_prefixsize.c | 5 | ||||
-rw-r--r-- | src/libs6rc/s6rc_servicedir_internal.c | 3 | ||||
-rw-r--r-- | src/s6-rc/s6-rc-update.c | 8 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/libs6rc/s6rc_livedir_prefixsize.c b/src/libs6rc/s6rc_livedir_prefixsize.c index d897fe6..ba14518 100644 --- a/src/libs6rc/s6rc_livedir_prefixsize.c +++ b/src/libs6rc/s6rc_livedir_prefixsize.c @@ -4,8 +4,11 @@ #include <string.h> #include <sys/stat.h> #include <errno.h> + #include <s6-rc/s6rc-utils.h> +#include <skalibs/posixishard.h> + int s6rc_livedir_prefixsize (char const *live, size_t *n) { struct stat st ; @@ -20,7 +23,7 @@ int s6rc_livedir_prefixsize (char const *live, size_t *n) return 1 ; } if (!S_ISREG(st.st_mode)) return (errno = EINVAL, 0) ; - if (st.st_size > PATH_MAX) return (errno = ENAMETOOLONG, 0) ; + if (st.st_size > SKALIBS_PATH_MAX) return (errno = ENAMETOOLONG, 0) ; *n = st.st_size ; return 1 ; } diff --git a/src/libs6rc/s6rc_servicedir_internal.c b/src/libs6rc/s6rc_servicedir_internal.c index 2c2c859..9c2e429 100644 --- a/src/libs6rc/s6rc_servicedir_internal.c +++ b/src/libs6rc/s6rc_servicedir_internal.c @@ -24,8 +24,7 @@ static s6_servicedir_desc const svdir_file_list[] = { .name = "timeout-finish", .type = S6_FILETYPE_UINT, .options = 0 }, { .name = "max-death-tally", .type = S6_FILETYPE_UINT, .options = 0 }, { .name = "down-signal", .type = S6_FILETYPE_NORMAL, .options = 0 }, - { .name = "instance", .type = S6_FILETYPE_DIR, .options = 0 }, - { .name = "instances", .type = S6_FILETYPE_DIR, .options = 0 }, + { .name = "template", .type = S6_FILETYPE_DIR, .options = 0 }, { .name = "data", .type = S6_FILETYPE_DIR, .options = 0 }, { .name = "env", .type = S6_FILETYPE_DIR, .options = 0 }, { .name = 0, .options = 0 } diff --git a/src/s6-rc/s6-rc-update.c b/src/s6-rc/s6-rc-update.c index 3cd5349..ced42d0 100644 --- a/src/s6-rc/s6-rc-update.c +++ b/src/s6-rc/s6-rc-update.c @@ -33,6 +33,8 @@ #include <s6-rc/config.h> #include <s6-rc/s6rc.h> +#include <skalibs/posixishard.h> + #define USAGE "s6-rc-update [ -n ] [ -v verbosity ] [ -t timeout ] [ -l live ] [ -f conversion_file ] [ -b ] newdb" #define dieusage() strerr_dieusage(100, USAGE) #define dienomem() strerr_diefu1sys(111, "build string") ; @@ -315,14 +317,14 @@ static inline void make_new_livedir (unsigned char const *oldstate, s6rc_db_t co pos = sa->len ; { ssize_t r ; - char sdtarget[PATH_MAX] ; + char sdtarget[SKALIBS_PATH_MAX] ; char sdlink[livelen + 9] ; unsigned char tmpstate[newdb->nlong + newdb->nshort] ; memcpy(sdlink, live, livelen) ; memcpy(sdlink + livelen, "/scandir", 9) ; - r = readlink(sdlink, sdtarget, PATH_MAX) ; + r = readlink(sdlink, sdtarget, SKALIBS_PATH_MAX) ; if (r < 0) strerr_diefu2sys(111, "readlink ", sdlink) ; - if (r >= PATH_MAX - 1) strerr_dief3x(100, "target for ", sdlink, " is too long") ; + if (r >= SKALIBS_PATH_MAX - 1) strerr_dief3x(100, "target for ", sdlink, " is too long") ; sdtarget[r] = 0 ; while (i--) tmpstate[i] = newstate[i] & 1 ; if (!s6rc_livedir_create(sa, live, PROG, sdtarget, prefix, newcompiled, tmpstate, newdb->nlong + newdb->nshort, &dirlen)) |