mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-08-19 15:56:02 +00:00
Improve dir checking in make_directories
Prefer faccessat to fstatat for dir checking. Also, don’t bother doing either check if caller is about to check the rough equivalent anyway. * src/extract.c (make_directories): Now static. 2nd arg is now a three-way flag. All uses changed. Use faccessat instead of fstatat, to avoid EOVERFLOW issues. (create_dir): New function, for use outside this module. External caller changed. (maybe_recoverable): Set *INTERDIR_MADE if make_directories said we made the parent.
This commit is contained in:
+2
-2
@@ -1129,8 +1129,8 @@ chdir_do (idx_t i, bool create)
|
||||
directory. The one-top-level directory is
|
||||
allowed to be given as an absolute path. */
|
||||
open_searchdir_how.resolve = 0;
|
||||
if (0 <= make_directories (curr->name, false))
|
||||
/* Directory created, retry */
|
||||
if (create_dir (curr->name))
|
||||
/* Directory likely exists now; retry. */
|
||||
fd = openat (chdir_fd, curr->name,
|
||||
open_searchdir_how.flags & ~O_NOFOLLOW);
|
||||
open_searchdir_how = saved_open_searchdir_how;
|
||||
|
||||
Reference in New Issue
Block a user