On 1/13/2020 10:31 AM, Corinna Vinschen wrote: > 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 for catching that. I'll fix it. Ken