changeset 765:e2e99fa861e9

Minor tweaks.
author Rob Landley <rob@landley.net>
date Sun, 23 Dec 2012 14:06:17 -0600
parents 0eed77046b51
children 5d435b48da8d
files toys/posix/mkdir.c
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 <georgi@unixsol.org>
  *
  * 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;
     }
   }