[PATCH v4 3/4] Cygwin: fstatat, fchownat: support the AT_EMPTY_PATH flag

2020-01-17 Thread Ken Brown
Following Linux, allow the pathname argument to be an empty string if the AT_EMPTY_PATH flag is specified. In this case the dirfd argument can refer to any type of file, not just a directory, and the call operates on that file. In particular, dirfd can refer to a symlink that was opened with O_PA

[PATCH v4 4/4] Cygwin: document recent changes

2020-01-17 Thread Ken Brown
--- winsup/cygwin/release/3.1.3 | 19 --- winsup/doc/new-features.xml | 15 +++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/release/3.1.3 b/winsup/cygwin/release/3.1.3 index 489741136..425d8bb2d 100644 --- a/winsup/cygwin/release/3.1.3

[PATCH v4 2/4] Cygwin: readlinkat: allow pathname to be empty

2020-01-17 Thread Ken Brown
Following Linux, allow the pathname argument to be an empty string, provided the dirfd argument refers to a symlink opened with O_PATH | O_NOFOLLOW. The readlinkat call then operates on that symlink. --- winsup/cygwin/syscalls.cc | 19 +-- 1 file changed, 17 insertions(+), 2 delet

[PATCH v4 0/4] Support opening a symlink with O_PATH | O_NOFOLLOW

2020-01-17 Thread Ken Brown
Currently, opening a symlink with O_NOFOLLOW fails with ELOOP. Following Linux, the first patch in this series allows the call to succeed if O_PATH is also specified. According to the Linux man page for open(2), "the call returns a file descriptor referring to the symbolic link. This file descrip

[PATCH v4 1/4] Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW

2020-01-17 Thread Ken Brown
Up to now, opening a symlink with O_NOFOLLOW fails with ELOOP. Following Linux, allow this to succeed if O_PATH is also specified. --- winsup/cygwin/syscalls.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 20126ce10

Re: [PATCH v3 2/3] Cygwin: readlinkat, fchownat: allow pathname to be empty

2020-01-17 Thread Corinna Vinschen
On Jan 16 20:50, Ken Brown wrote: > Following Linux, allow the pathname argument to be an empty string, > provided the dirfd argument refers to a symlink opened with O_PATH and > O_NOFOLLOW. The readlinkat or fchownat call then operates on that > symlink. In the case of fchownat, the call must sp

Re: [PATCH] Cygwin: allow opening an AF_LOCAL/AF_UNIX socket with O_PATH

2020-01-17 Thread Corinna Vinschen
On Jan 17 10:48, Corinna Vinschen wrote: > On Jan 16 18:34, Ken Brown wrote: > > If that flag is not set, or if an attempt is made to open a different > > type of socket, the errno is now EOPNOTSUPP instead of ENXIO. This is > > consistent with POSIX, starting with the 2016 edition. Earlier > > e

Re: [PATCH] Cygwin: allow opening an AF_LOCAL/AF_UNIX socket with O_PATH

2020-01-17 Thread Corinna Vinschen
On Jan 16 18:34, Ken Brown wrote: > If that flag is not set, or if an attempt is made to open a different > type of socket, the errno is now EOPNOTSUPP instead of ENXIO. This is > consistent with POSIX, starting with the 2016 edition. Earlier > editions were silent on this issue. > --- > winsup/

Re: [PATCH] Cygwin: normalize_win32_path: allow drive without trailing backslash

2020-01-17 Thread Corinna Vinschen
On Jan 15 17:46, Ken Brown wrote: > Commit 283cb372, "Cygwin: normalize_win32_path: improve error > checking", required a prefix '\\?\' or '\??\' in the source path to be > followed by 'UNC\' or 'X:\', where X is a drive letter. That was too > restrictive, since it disallowed the paths '\\?\X: and