From 0264df40be306e5375fe1ae5ad2eda56f6405cae Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 1 Jun 2020 00:18:40 +0000 Subject: Nothing to see here, just prepare for 2.2.2.4 --- src/skaembutils/s6-mkdir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/skaembutils') diff --git a/src/skaembutils/s6-mkdir.c b/src/skaembutils/s6-mkdir.c index 352669a..4d1d7b9 100644 --- a/src/skaembutils/s6-mkdir.c +++ b/src/skaembutils/s6-mkdir.c @@ -10,6 +10,7 @@ #include #define USAGE "s6-mkdir [ -p ] [ -v ] [ -m mode ] dir" +#define dieusage() strerr_dieusage(100, USAGE) static int doit (char const *s, unsigned int mode, int verbose, int ee) { @@ -54,6 +55,7 @@ int main (int argc, char const *const *argv) int parents = 0, verbose = 0 ; unsigned int mode = 0777 ; int e = 0 ; + int noumask = 0 ; PROG = "s6-mkdir" ; { subgetopt_t l = SUBGETOPT_ZERO ; @@ -65,13 +67,13 @@ int main (int argc, char const *const *argv) { case 'p': parents = 1 ; break ; case 'v': verbose = 1 ; break ; - case 'm': if (uint_oscan(l.arg, &mode)) break ; + case 'm': if (!uint_oscan(l.arg, &mode)) dieusage() ; noumask = 1 ; break ; default : strerr_dieusage(100, USAGE) ; } } argc -= l.ind ; argv += l.ind ; } - umask(0) ; + if (noumask) umask(0) ; for ( ; *argv ; argv++) e |= parents ? doparents(*argv, mode, verbose) : doit(*argv, mode, verbose, 1) ; -- cgit v1.2.3