From 92124defa008812c37a92c700eee67f04e259111 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 31 Jan 2023 12:25:53 +0000 Subject: Don't create instance/instances subdirs in s6-rc source defs Signed-off-by: Laurent Bercot --- src/instance/s6-instance-maker.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/instance/s6-instance-maker.c b/src/instance/s6-instance-maker.c index fcb67ac..d0875e0 100644 --- a/src/instance/s6-instance-maker.c +++ b/src/instance/s6-instance-maker.c @@ -61,16 +61,18 @@ static void write_service (char const *dir, char const *template, char const *us { svinfo data = { .user = user, .maxinstances = maxinstances } ; size_t dirlen = strlen(dir) ; - mode_t m ; char fn[dirlen + 11] ; - s6_auto_write_service(dir, 3, &write_run, &data, logger) ; memcpy(fn, dir, dirlen) ; - memcpy(fn + dirlen, "/instance", 10) ; - m = umask(0) ; - if (mkdir(fn, 0755) == -1) strerr_diefu2sys(111, "mkdir ", fn) ; - memcpy(fn + dirlen + 9, "s", 2) ; - if (mkdir(fn, 0755) == -1) strerr_diefu2sys(111, "mkdir ", fn) ; - umask(m) ; + s6_auto_write_service(dir, 3, &write_run, &data, logger) ; + if (!logger) + { + mode_t m = umask(0) ; + memcpy(fn + dirlen, "/instance", 10) ; + if (mkdir(fn, 0755) == -1) strerr_diefu2sys(111, "mkdir ", fn) ; + memcpy(fn + dirlen + 9, "s", 2) ; + if (mkdir(fn, 0755) == -1) strerr_diefu2sys(111, "mkdir ", fn) ; + umask(m) ; + } memcpy(fn + dirlen, "/template", 10) ; if (!hiercopy_tmp(template, fn, &sa)) strerr_diefu4sys(111, "copy file hierarchy from ", template, " to ", fn) ; -- cgit v1.2.3