cvs-send-recv-posix
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sun, 28 May 2017 17:29:33 +0000 (17:29 +0000)
committerAurelien Jarno <aurel32@debian.org>
Sun, 28 May 2017 17:29:33 +0000 (17:29 +0000)
commit 9d067269f5c3ecc5913e7e424a4778608d784731
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Mon Mar 13 20:41:12 2017 +0100

    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.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name cvs-send-recv-posix.diff

sysdeps/mach/hurd/recv.c
sysdeps/mach/hurd/send.c

index 1534228c0ad254e1d5128de1d4f093bafdf22434..d75cf665bad72d23958d7cf6b41fc033d77f382c 100644 (file)
@@ -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);
index cc7d2a8b86fc6b64cbe17fc65f7bfa6288ef9a1b..3bcd749c15e3b447a862edb89b0600beefac4f6a 100644 (file)
@@ -33,6 +33,10 @@ __send (int fd, const void *buf, size_t n, int flags)
                                           NULL, MACH_MSG_TYPE_COPY_SEND, 0,
                                           NULL, 0, &wrote));
 
+  if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+    /* The file did not grok the socket protocol.  */
+    err = ENOTSOCK;
+
   return err ? __hurd_sockfail (fd, flags, err) : wrote;
 }
 libc_hidden_def (__send)