mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-04-26 03:20:40 +00:00
Prefer O_PATH to O_SEARCH on Linux kernels
* src/tar.c (decode_options): Prefer O_PATH to an O_SEARCH that is actually O_RDONLY.
This commit is contained in:
@@ -2701,7 +2701,12 @@ decode_options (int argc, char **argv)
|
||||
| (dereference_option ? 0 : O_NOFOLLOW)
|
||||
| (atime_preserve_option == system_atime_preserve ? O_NOATIME : 0));
|
||||
open_read_flags = O_RDONLY | base_open_flags;
|
||||
open_searchdir_flags = O_SEARCH | O_DIRECTORY | base_open_flags;
|
||||
#if defined O_PATH && O_SEARCH == O_RDONLY
|
||||
int open_search_flag = O_PATH;
|
||||
#else
|
||||
int open_search_flag = O_SEARCH;
|
||||
#endif
|
||||
open_searchdir_flags = open_search_flag | O_DIRECTORY | base_open_flags;
|
||||
}
|
||||
fstatat_flags = dereference_option ? 0 : AT_SYMLINK_NOFOLLOW;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user