[PATCH] Cygwin: fhandler_socket::open: support the O_PATH flag
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Jan 13 15:31:00 GMT 2020
Hi Ken,
On Dec 26 15:25, Ken Brown wrote:
> If that flag is not set, fail with EOPNOTSUPP instead of ENXIO. This
> is consistent with POSIX, starting with the 2016 edition. Earlier
> editions were silent on this issue.
> ---
> winsup/cygwin/fhandler_socket.cc | 13 +++++++++++--
> winsup/cygwin/release/3.1.3 | 5 +++++
> winsup/doc/new-features.xml | 5 +++++
> 3 files changed, 21 insertions(+), 2 deletions(-)
> create mode 100644 winsup/cygwin/release/3.1.3
>
> diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
> index 9f33d8087..4a46d5a64 100644
> --- a/winsup/cygwin/fhandler_socket.cc
> +++ b/winsup/cygwin/fhandler_socket.cc
> @@ -269,8 +269,17 @@ fhandler_socket::fcntl (int cmd, intptr_t arg)
> int
> fhandler_socket::open (int flags, mode_t mode)
> {
> - set_errno (ENXIO);
> - return 0;
> + /* We don't support opening sockets unless O_PATH is specified. */
> + if (!(flags & O_PATH))
> + {
> + set_errno (EOPNOTSUPP);
> + return 0;
> + }
> +
> + query_open (query_read_attributes);
> + nohandle (true);
> + set_flags (flags);
Shouldn't that only work with AF_LOCAL/AF_UNIX sockets? This looks
like it will return a valid descriptor even for IP sockets.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200113/956f1b61/attachment.sig>
More information about the Cygwin-patches
mailing list