From aa35510f1003777d309fa345ac373ba1b572c5ce Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 31 Jan 2023 11:18:24 +0000 Subject: Don't hard depend on PATH_MAX; change servicedir file list Signed-off-by: Laurent Bercot --- src/libs6rc/s6rc_livedir_prefixsize.c | 5 ++++- src/libs6rc/s6rc_servicedir_internal.c | 3 +-- src/s6-rc/s6-rc-update.c | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') 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 #include #include + #include +#include + 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 #include +#include + #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)) -- cgit v1.2.3