Details
-
Bug
-
Resolution: Unresolved
-
P5: Not important
-
None
-
4.8.5
-
None
-
Operating System: Debian GNU/Hurd unstable/unreleased
Description
There is a problem with the SOCK_CLOEXEC detection on GNU Hurd.
In the file "src/network/socket/qnet_unix_p.h" there is a function named qt_safe_socket:
There is an #ifdef'ed part that tries to open the socket using the SOCK_CLOEXEC flag first:
#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
int newtype = type | SOCK_CLOEXEC;
if (flags & O_NONBLOCK)
newtype |= SOCK_NONBLOCK;
fd = ::socket(domain, newtype, protocol);
if (fd != -1 || errno != EINVAL)
return fd;
#endif
The "errno != EINVAL" part seems to be there to support older versions of Linux (before 2.6.23).
So this test ensurs that the function does not return when the kernel doesn't support SOCK_CLOEXEC.
The GNU Hurd system handles this differently than Linux, it's using EPROTOTYPE instead of EINVAL in this situation. (GNU Hurd doesn't currently have SOCK_CLOEXEC support)
After patching the test to "if (fd != -1 || !(errno == EINVAL || errno == EPROTOTYPE))" the test is working on GNU Hurd.
I have discussed this issue on the Debian GNU/Hurd mailing list here: