Problem reported by Lauri Tirkkonen <https://bugs.gnu.org/79072>.
* lib/mkdir-p.c (make_dir_parents):
If savewd_chdir fails due to anything other than EACCES, do
not attempt to preserve permissions; instead, fail with mkdir’s
errno if nonzero, and with savewd_chdir’s errno otherwise.
+2025-07-22 Paul Eggert <eggert@cs.ucla.edu>
+
+ mkdir-p: better diagnostics
+ Problem reported by Lauri Tirkkonen <https://bugs.gnu.org/79072>.
+ * lib/mkdir-p.c (make_dir_parents):
+ If savewd_chdir fails due to anything other than EACCES, do
+ not attempt to preserve permissions; instead, fail with mkdir’s
+ errno if nonzero, and with savewd_chdir’s errno otherwise.
+
2025-07-21 Collin Funk <collin.funk1@gmail.com>
sys_un-h: Make sure that the 'sys' subdirectory is created.
savewd_chdir_options, open_result);
if (chdir_result < -1)
return true;
- else
+ else if (chdir_result == 0 || errno == EACCES)
{
bool chdir_ok = (chdir_result == 0);
char const *subdir = (chdir_ok ? "." : dir + prefix_len);
return false;
}
}
+ else
+ {
+ if (mkdir_errno == 0)
+ mkdir_errno = errno;
+ if (0 <= open_result[0])
+ close (open_result[0]);
+ }
}
}
}