File: cvs-send-recv-posix.diff

package info (click to toggle)
glibc 2.24-10
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 223,412 kB
  • sloc: ansic: 991,967; asm: 261,800; sh: 10,385; makefile: 9,710; cpp: 4,169; python: 3,971; perl: 2,254; awk: 1,753; pascal: 1,521; yacc: 291; sed: 80
file content (50 lines) | stat: -rw-r--r-- 1,739 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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.

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);
diff --git a/sysdeps/mach/hurd/send.c b/sysdeps/mach/hurd/send.c
index 8eb97e99ee..98ffcbf562 100644
--- a/sysdeps/mach/hurd/send.c
+++ b/sysdeps/mach/hurd/send.c
@@ -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)