[PATCH] Cygwin: fhandler_socket::open: set errno according to POSIX

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Cygwin: fhandler_socket::open: set errno according to POSIX

Ken Brown-6
Set errno to EOPNOTSUPP instead of ENXIO when 'open' is called on a
socket.  This is consistent with POSIX, starting with the 2016
edition.  Earlier editions were silent on this issue.
---
 winsup/cygwin/fhandler_socket.cc | 2 +-
 winsup/cygwin/release/3.1.3      | 5 +++++
 winsup/doc/new-features.xml      | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)
 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..227004b43 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -269,7 +269,7 @@ fhandler_socket::fcntl (int cmd, intptr_t arg)
 int
 fhandler_socket::open (int flags, mode_t mode)
 {
-  set_errno (ENXIO);
+  set_errno (EOPNOTSUPP);
   return 0;
 }
 
diff --git a/winsup/cygwin/release/3.1.3 b/winsup/cygwin/release/3.1.3
new file mode 100644
index 000000000..654201c6f
--- /dev/null
+++ b/winsup/cygwin/release/3.1.3
@@ -0,0 +1,5 @@
+What changed:
+-------------
+
+- The errno is now EOPNOTSUPP instead of ENXIO when 'open' is called
+  on a socket.
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 65bdc17ab..1d93c7730 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -54,6 +54,10 @@ Allow times(2) to have a NULL argument, as on Linux.
 Improve /proc/cpuinfo output and align more closely with Linux.
 </para></listitem>
 
+<listitem><para>
+The errno is now EOPNOTSUPP instead of ENXIO when 'open' is called on a socket.
+</para></listitem>
+
 </itemizedlist>
 
 </sect2>
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Cygwin: fhandler_socket::open: set errno according to POSIX

Ken Brown-6
On 12/24/2019 2:27 PM, Ken Brown wrote:
> Set errno to EOPNOTSUPP instead of ENXIO when 'open' is called on a
> socket.  This is consistent with POSIX, starting with the 2016
> edition.  Earlier editions were silent on this issue.

Please ignore this patch.  A more comprehensive patch is coming soon.

Ken