summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-04-12 00:35:30 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-04-12 00:35:30 +0000
commit02247d36e7488d4980fa9e767b3c4a003294b140 (patch)
tree79d11c6b3704d17fdae59c9256d5d7b42c5888fa
parent57d2531ea572de8991ee0a63475464459c39f7d6 (diff)
downloads6-02247d36e7488d4980fa9e767b3c4a003294b140.tar.xz
bugfix: umask in s6-usertree-maker
-rw-r--r--src/usertree/s6-usertree-maker.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/usertree/s6-usertree-maker.c b/src/usertree/s6-usertree-maker.c
index 6a9a42b..37a2771 100644
--- a/src/usertree/s6-usertree-maker.c
+++ b/src/usertree/s6-usertree-maker.c
@@ -224,6 +224,7 @@ int main (int argc, char *const *argv)
uint64_t maxsize = 0 ;
size_t dirlen ;
size_t varlen = 0 ;
+ mode_t m ;
char const *vars[VARS_MAX] ;
PROG = "s6-usertree-maker" ;
{
@@ -278,8 +279,8 @@ int main (int argc, char *const *argv)
if (strchr(rcinfo[2], '/')) strerr_dief2x(100, "slashes", " are forbidden in s6-rc names") ;
}
}
- mask = umask(0) ;
- mask = ~mask & 0666 ;
+ m = umask(0) ;
+ mask = ~m & 0666 ;
dirlen = strlen(argv[2]) ;
if (rcinfo[0])
@@ -295,7 +296,7 @@ int main (int argc, char *const *argv)
if (mkdir(dir, 0755) < 0) strerr_diefu2sys(111, "mkdir ", dir) ;
memcpy(dir + dirlen + 1, rcinfo[1], loglen + 1) ;
if (mkdir(dir, 0755) < 0) strerr_diefu2sys(111, "mkdir ", dir) ;
- umask(mask) ;
+ umask(m) ;
write_logger(dir, loguser, argv[1], stamptype, nfiles, filesize, maxsize, rcinfo[0], rcinfo[2]) ;
memcpy(dir + dirlen + 1, rcinfo[0], svclen + 1) ;
write_service(dir, argv[0], userscandir, rcinfo[1], path, userenvdir, vars, varlen) ;
@@ -307,7 +308,7 @@ int main (int argc, char *const *argv)
memcpy(dir + dirlen, "/log", 5) ;
if (mkdir(argv[2], 0755) < 0) strerr_diefu2sys(111, "mkdir ", argv[2]) ;
if (mkdir(dir, 0755) < 0) strerr_diefu2sys(111, "mkdir ", argv[2]) ;
- umask(mask) ;
+ umask(m) ;
write_service(argv[2], argv[0], userscandir, 0, path, userenvdir, vars, varlen) ;
write_logger(dir, loguser, argv[1], stamptype, nfiles, filesize, maxsize, 0, 0) ;
}