diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-03-13 20:41:12 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-03-13 20:41:12 +0100 |
commit | 9d067269f5c3ecc5913e7e424a4778608d784731 (patch) | |
tree | c561c33582a593249173f8923be0c56d871c7c0c | |
parent | c89721e25d609ec4f3366a3956b2f3e5acd76e77 (diff) | |
download | glibc-9d067269f5c3ecc5913e7e424a4778608d784731.tar glibc-9d067269f5c3ecc5913e7e424a4778608d784731.tar.gz glibc-9d067269f5c3ecc5913e7e424a4778608d784731.tar.bz2 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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sysdeps/mach/hurd/recv.c | 8 | ||||
-rw-r--r-- | sysdeps/mach/hurd/send.c | 4 |
3 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2017-03-13 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * sysdeps/mach/hurd/send.c (__send): Convert hurdish error code into + posix error code. + * sysdeps/mach/hurd/recv.c (__recv): Likewise. + 2017-03-13 Adhemerval Zanella <adhemerval.zanella@linaro.org> * scripts/build-many-glibcs.py (Context.add_all_configs): Remove 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) |