.
authorJim Meyering <jim@meyering.net>
Sun, 3 Jul 1994 13:18:31 +0000 (13:18 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 3 Jul 1994 13:18:31 +0000 (13:18 +0000)
lib/makepath.c

index bb6a09c12ca8f895a6cac13a039c85213a3c1fb2..4d647b5ef3160a5bcdd1cf8c80bdd7b51a1b3f34 100644 (file)
@@ -206,7 +206,10 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
       /* We're done making leading directories.
         Make the final component of the path.  */
 
-      if (mkdir (dirpath, mode))
+      /* The path could end in "/." or contain "/..", so test
+        if we really have to create the directory.  */
+
+      if (stat (dirpath, &stats) && mkdir (dirpath, mode))
        {
          error (0, errno, "cannot make directory `%s'", dirpath);
          umask (oldmask);