diff options
author | Jim Meyering <jim@meyering.net> | 1998-02-11 22:17:38 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-02-11 22:17:38 +0000 |
commit | 65978b63288b9a24bbc36155ed05ebb40c3cf55d (patch) | |
tree | 5b9cd3f481b12495312c0338028c6a3a9fc1d0ab /lib/makepath.c | |
parent | 5f8949c46cf18051908419c894ac4ad78a626c0c (diff) | |
download | coreutils-65978b63288b9a24bbc36155ed05ebb40c3cf55d.tar.xz |
Add my comment from ChangeLog entry for gkm's change.
Diffstat (limited to 'lib/makepath.c')
-rw-r--r-- | lib/makepath.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/makepath.c b/lib/makepath.c index ea0a021d8..99119a213 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -217,6 +217,14 @@ make_path (const char *argpath, 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)) { |