summary refs log tree commit diff
path: root/sysdeps/mach/hurd/recv.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2017-03-13 20:41:12 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-03-13 20:41:12 +0100
commit9d067269f5c3ecc5913e7e424a4778608d784731 (patch)
treec561c33582a593249173f8923be0c56d871c7c0c /sysdeps/mach/hurd/recv.c
parentc89721e25d609ec4f3366a3956b2f3e5acd76e77 (diff)
downloadglibc-9d067269f5c3ecc5913e7e424a4778608d784731.tar.gz
glibc-9d067269f5c3ecc5913e7e424a4778608d784731.tar.xz
glibc-9d067269f5c3ecc5913e7e424a4778608d784731.zip
hurd: Make send/recv more posixish
Thanks David Michael for the suggestion.

	* sysdeps/mach/hurd/send.c (__send): Convert hurdish error code into
	posix error code.
	* sysdeps/mach/hurd/recv.c (__recv): Likewise.
Diffstat (limited to 'sysdeps/mach/hurd/recv.c')
-rw-r--r--sysdeps/mach/hurd/recv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/recv.c b/sysdeps/mach/hurd/recv.c
index 78a67d0cd8..133f49dfaa 100644
--- a/sysdeps/mach/hurd/recv.c
+++ b/sysdeps/mach/hurd/recv.c
@@ -37,12 +37,16 @@ __recv (int fd, void *buf, size_t n, int flags)
   char *cdata = NULL;
   mach_msg_type_number_t clen = 0;
 
-  if (err = HURD_DPORT_USE (fd, __socket_recv (port, &addrport,
+  err = HURD_DPORT_USE (fd, __socket_recv (port, &addrport,
 					       flags, &bufp, &nread,
 					       &ports, &nports,
 					       &cdata, &clen,
 					       &flags,
-					       n)))
+					       n));
+  if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+    /* The file did not grok the socket protocol.  */
+    err = ENOTSOCK;
+  if (err)
     return __hurd_sockfail (fd, flags, err);
 
   __mach_port_deallocate (__mach_task_self (), addrport);