Index: src/OFUNIXDatagramSocket.m ================================================================== --- src/OFUNIXDatagramSocket.m +++ src/OFUNIXDatagramSocket.m @@ -20,10 +20,12 @@ #include "config.h" #ifdef HAVE_FCNTL_H # include #endif + +#include #import "OFUNIXDatagramSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" @@ -34,14 +36,15 @@ @implementation OFUNIXDatagramSocket @dynamic delegate; - (OFSocketAddress)bindToPath: (OFString *)path { +#ifndef OF_HURD OFSocketAddress address; -#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) +# if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; -#endif +# endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if (path != nil) @@ -58,14 +61,14 @@ socket: self errNo: _OFSocketErrNo()]; _canBlock = true; -#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) +# if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); -#endif +# endif if (path != nil) { if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); @@ -79,7 +82,17 @@ errNo: errNo]; } } return address; +#else + /* + * Datagram UNIX sockets on Hurd are broken and don't return the sender + * correctly when using recvfrom(). + */ + @throw [OFBindUNIXSocketFailedException + exceptionWithPath: path + socket: self + errNo: EAFNOSUPPORT]; +#endif } @end