summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-07-09 14:00:27 +0000
committerJim Meyering <jim@meyering.net>1997-07-09 14:00:27 +0000
commit6bb8c4e904c49857d84fed4754fefed304a5e439 (patch)
treec5c8e853b948eb598719f81d2583cdd0f515bd4c
parent89743fce5c8ff36b69a1799d617afed2be9a7957 (diff)
downloadcoreutils-6bb8c4e904c49857d84fed4754fefed304a5e439.tar.xz
Add comments.
-rw-r--r--lib/makepath.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/makepath.c b/lib/makepath.c
index e6e65f632..17844318a 100644
--- a/lib/makepath.c
+++ b/lib/makepath.c
@@ -210,6 +210,9 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
saved_cwd = !save_cwd (&cwd);
}
+ /* If save_cwd could not record the current directory, then don't
+ do the chdir optimization and resort to using full pathnames. */
+
if (!saved_cwd)
basename_dir = dirpath;
@@ -258,6 +261,10 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
leading_dirs = new;
}
+ /* If we were able to save the initial working directory,
+ then we can use chdir to change into each directory before
+ creating an entry in that directory. This avoids making
+ stat and mkdir process O(n^2) file name components. */
if (saved_cwd && chdir (basename_dir) < 0)
{
error (0, errno, "cannot chdir to directory, %s", dirpath);