merge with 1.10e
[gnulib.git] / lib / makepath.c
index 9e70ed7..4d647b5 100644 (file)
@@ -21,8 +21,8 @@
 #ifdef HAVE_CONFIG_H
 #if defined (CONFIG_BROKETS)
 /* We use <config.h> instead of "config.h" so that a compilation
-   using -I. -I will use ./config.h rather than /config.h
-   (which it would do because it found this file in ).  */
+   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+   (which it would do because it found this file in $srcdir).  */
 #include <config.h>
 #else
 #include "config.h"
@@ -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);