From e5af216104c71b817b7000a09942dbabc468c1d7 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 23 Dec 2012 14:06:17 -0600 Subject: Minor tweaks. --- toys/posix/mkdir.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'toys/posix/mkdir.c') diff --git a/toys/posix/mkdir.c b/toys/posix/mkdir.c index 746a918a..a523fd59 100644 --- a/toys/posix/mkdir.c +++ b/toys/posix/mkdir.c @@ -3,7 +3,6 @@ * Copyright 2012 Georgi Chorbadzhiyski * * See http://opengroup.org/onlinepubs/9699919799/utilities/mkdir.html - * USE_MKDIR(NEWTOY(mkdir, "<1pm:", TOYFLAG_BIN)) @@ -23,6 +22,7 @@ config MKDIR GLOBALS( char *arg_mode; + mode_t mode; ) @@ -52,8 +52,7 @@ static int do_mkdir(char *dir) } else if (*s) continue; // Use the mode from the -m option only for the last directory. - if ((toys.optflags&FLAG_m) && save != '/') - mode = TT.mode; + if ((toys.optflags&FLAG_m) && save != '/') mode = TT.mode; if (mkdir(dir, mode)<0 && ((toys.optflags&~FLAG_p) || errno != EEXIST)) return 1; @@ -68,13 +67,11 @@ void mkdir_main(void) { char **s; - TT.mode = 0777; - if(toys.optflags&FLAG_m) - TT.mode = string_to_mode(TT.arg_mode, TT.mode); + if(toys.optflags&FLAG_m) TT.mode = string_to_mode(TT.arg_mode, 0777); for (s=toys.optargs; *s; s++) { if (do_mkdir(*s)) { - perror_msg("cannot create directory '%s'", *s); + perror_msg("'%s'", *s); toys.exitval = 1; } } -- cgit v1.2.3