aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-12-23 14:06:17 -0600
committerRob Landley <rob@landley.net>2012-12-23 14:06:17 -0600
commite5af216104c71b817b7000a09942dbabc468c1d7 (patch)
tree40f92e23381ae95d41dc7858f6b2bb2c07a8a604
parentc5b15dbd1aa21566417d606111b02e993069408c (diff)
downloadtoybox-e5af216104c71b817b7000a09942dbabc468c1d7.tar.gz
Minor tweaks.
-rw-r--r--toys/posix/mkdir.c11
1 files changed, 4 insertions, 7 deletions
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 <georgi@unixsol.org>
*
* 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;
}
}