Do not set the permissions of the final directory
authorJim Meyering <jim@meyering.net>
Thu, 9 Nov 2000 22:21:59 +0000 (22:21 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 9 Nov 2000 22:21:59 +0000 (22:21 +0000)
component if it was not just created.
Based on a patch from Volker Borchert.

src/mkdir.c

index bc5ad0e..398677f 100644 (file)
@@ -174,7 +174,10 @@ main (int argc, char **argv)
             This extra step is necessary in some cases when the containing
             directory has a default ACL.  */
 
-         if (fail == 0 && specified_mode)
+         /* Set the permissions only if this directory has just
+            been created.  */
+
+         if (fail == 0 && specified_mode && dir_created)
            {
              fail = chmod (dir, newmode);
              if (fail)