[PATCH 0/5] Fix AT_EMPTY_PATH handling
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Jul 12 12:07:59 GMT 2023
From: Corinna Vinschen <corinna@vinschen.de>
The GLIBC extension AT_EMPTY_PATH allows the functions fchownat
and fstatat to operate on dirfd alone, if the given pathname is an
empty string. This also allows to operate on any file type, not
only directories.
Commit fa84aa4dd2fb4 broke this. It only allows dirfd to be a
directory in calls to these two functions.
Fix that by handling AT_EMPTY_PATH right in gen_full_path_at.
A valid dirfd and an empty pathname is now a valid combination
and, noticably, this returns a valid path in path_ret. That
in turn allows to remove the additional path generation code
from the callers.
Fixes: fa84aa4dd2fb ("Cygwin: fix errno values set by readlinkat")
Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen (5):
Cygwin: gen_full_path_at: drop never reached code
Define _AT_NULL_PATHNAME_ALLOWED
Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag
Cygwin: Fix and streamline AT_EMPTY_PATH handling
Cygwin: add AT_EMPTY_PATH fix to release message
newlib/libc/include/sys/_default_fcntl.h | 11 +++--
winsup/cygwin/release/3.4.8 | 4 ++
winsup/cygwin/syscalls.cc | 61 ++++++------------------
3 files changed, 25 insertions(+), 51 deletions(-)
--
2.40.1
More information about the Cygwin-patches
mailing list