From 8cb06096ab2a72fad7b05d380d3848e8535c539e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 28 Jan 2026 20:01:54 +0000 Subject: s6-rc-repo-init: check validity of stores before creating links --- src/repo/s6-rc-repo-init.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/repo/s6-rc-repo-init.c b/src/repo/s6-rc-repo-init.c index fd3b916..c190bee 100644 --- a/src/repo/s6-rc-repo-init.c +++ b/src/repo/s6-rc-repo-init.c @@ -88,6 +88,17 @@ int main (int argc, char const *const *argv) if (strchr(argv[i], '\n')) strerr_dief1x(100, "stores cannot contain newlines in their path") ; } + for (uint16_t i = 0 ; i < argc ; i++) + { + struct stat st ; + if (stat(argv[i], &st) == -1) + strerr_diefu2sys(111, "stat ", argv[i]) ; + if (!S_ISDIR(st.st_mode)) + strerr_dief2x(111, argv[i], " is not a directory") ; + if (access(argv[i], X_OK) == -1) + strerr_diefu2sys(111, "access ", argv[i]) ; + } + repolen = strlen(wgola[GOLA_REPODIR]) ; tain_now_g() ; -- cgit v1.3.1