summaryrefslogtreecommitdiff
path: root/src/instance/s6-instance-maker.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-01-31 12:25:53 +0000
committerLaurent Bercot <ska@appnovation.com>2023-01-31 12:25:53 +0000
commit92124defa008812c37a92c700eee67f04e259111 (patch)
tree58b5f50c6665a0be89298b1203a6e82b45238973 /src/instance/s6-instance-maker.c
parent80d231165357cf0d57b23dfe3b0aa16c7cb79545 (diff)
downloads6-92124defa008812c37a92c700eee67f04e259111.tar.xz
Don't create instance/instances subdirs in s6-rc source defs
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/instance/s6-instance-maker.c')
-rw-r--r--src/instance/s6-instance-maker.c18
1 files 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) ;