summaryrefslogtreecommitdiff
path: root/lib/mkancesdirs.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-09-22 20:04:13 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-09-22 20:05:01 -0700
commite6f00a579ebdaa540d8afc99fff9825e27794320 (patch)
tree714c29bcab6dc39d4342aab792ceb0fa6d0490c6 /lib/mkancesdirs.c
parent6b34bf6d25e69d36df1cc70dd193df245a5a072d (diff)
downloadgnulib-e6f00a579ebdaa540d8afc99fff9825e27794320.tar.gz
savewd: remove SAVEWD_CHDIR_READABLE
It was problematic in the light of file systems that ignore umask. Problem reported by Sebastian Ungar in: http://bugs.gnu.org/21534 * NEWS: Document this. * lib/mkancesdirs.c (mkancesdirs): MAKE_DIR now returns 0 if successful, -1 (setting errno) on failure, rather than something more complicated than that. * lib/mkdir-p.c (make_dir_parents): Do not use SAVEWD_CHDIR_READABLE. * lib/savewd.c (savewd_chdir): Remove support for SAVEWD_CHDIR_READABLE. * lib/savewd.h (SAVEWD_CHDIR_READABLE): Remove.
Diffstat (limited to 'lib/mkancesdirs.c')
-rw-r--r--lib/mkancesdirs.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/lib/mkancesdirs.c b/lib/mkancesdirs.c
index 91ed694aac..2747d4a649 100644
--- a/lib/mkancesdirs.c
+++ b/lib/mkancesdirs.c
@@ -42,11 +42,9 @@
Create any ancestor directories that don't already exist, by
invoking MAKE_DIR (FILE, COMPONENT, MAKE_DIR_ARG). This function
- should return 0 if successful and the resulting directory is
- readable, 1 if successful but the resulting directory might not be
- readable, -1 (setting errno) otherwise. If COMPONENT is relative,
- it is relative to the temporary working directory, which may differ
- from *WD.
+ should return 0 if successful, -1 (setting errno) otherwise. If
+ COMPONENT is relative, it is relative to the temporary working
+ directory, which may differ from *WD.
Ordinarily MAKE_DIR is executed with the working directory changed
to reflect the already-made prefix, and mkancesdirs returns with
@@ -112,20 +110,10 @@ mkancesdirs (char *file, struct savewd *wd,
if (sep - component == 2
&& component[0] == '.' && component[1] == '.')
made_dir = false;
+ else if (make_dir (file, component, make_dir_arg) < 0)
+ make_dir_errno = errno;
else
- switch (make_dir (file, component, make_dir_arg))
- {
- case -1:
- make_dir_errno = errno;
- break;
-
- case 0:
- savewd_chdir_options |= SAVEWD_CHDIR_READABLE;
- /* Fall through. */
- case 1:
- made_dir = true;
- break;
- }
+ made_dir = true;
if (made_dir)
savewd_chdir_options |= SAVEWD_CHDIR_NOFOLLOW;