changeset 1239:5fe96529d35b

Add my comment from ChangeLog entry for gkm's change.
author Jim Meyering <jim@meyering.net>
date Wed, 11 Feb 1998 22:17:38 +0000
parents cfa0ed1ca6f2
children 92fcf946db19
files lib/makepath.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/makepath.c
+++ b/lib/makepath.c
@@ -217,6 +217,14 @@
 	  if (!do_chdir)
 	    basename_dir = dirpath;
 
+	  /* The mkdir and stat calls below appear to be reversed.
+	     They are not.  It is important to call mkdir first and then to
+	     call stat (to distinguish the three cases) only if mkdir fails.
+	     The alternative to this approach is to `stat' each directory,
+	     then to call mkdir if it doesn't exist.  But if some other process
+	     were to create the directory between the stat & mkdir, the mkdir
+	     would fail with EEXIST.  */
+
 	  *slash = '\0';
 	  if (mkdir (basename_dir, tmp_mode))
 	    {