commit 92124defa008812c37a92c700eee67f04e259111
parent 80d231165357cf0d57b23dfe3b0aa16c7cb79545
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Tue, 31 Jan 2023 12:25:53 +0000
Don't create instance/instances subdirs in s6-rc source defs
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git 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) ;