# HG changeset patch # User Rob Landley # Date 1356293177 21600 # Node ID e2e99fa861e96fb3705ff73eca590f969e802596 # Parent 0eed77046b514731460d4d38c3ea1cd2bac33b56 Minor tweaks. diff -r 0eed77046b51 -r e2e99fa861e9 toys/posix/mkdir.c --- a/toys/posix/mkdir.c Sun Dec 23 17:44:35 2012 +0100 +++ b/toys/posix/mkdir.c Sun Dec 23 14:06:17 2012 -0600 @@ -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 @@ GLOBALS( char *arg_mode; + mode_t mode; ) @@ -52,8 +52,7 @@ } 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 @@ { 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; } }