about 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>2020-06-14 00:19:35 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-14 00:19:35 +0000
commit89edef7b390ab25fc0d41ef6fc618f5e22c7551b (patch)
treefd3e571f336520b5d83255489abde6400660986b /sysdeps/mach/hurd/recv.c
parent146fea07640387c78e334933de24b6353e1f0eba (diff)
downloadglibc-89edef7b390ab25fc0d41ef6fc618f5e22c7551b.tar.gz
glibc-89edef7b390ab25fc0d41ef6fc618f5e22c7551b.tar.xz
glibc-89edef7b390ab25fc0d41ef6fc618f5e22c7551b.zip
hurd: Make recv* cancellation points
* sysdeps/mach/hurd/recv.c (__recv): Make the __socket_recv call
cancellable.
* sysdeps/mach/hurd/recvfrom.c (__recvfrom): Make the __socket_recv and
__socket_whatis_address calls cancellable.
* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Make the __socket_recv,
__socket_whatis_address, __io_reauthenticate, and __auth_user_authenticate calls
cancellable.
Diffstat (limited to 'sysdeps/mach/hurd/recv.c')
-rw-r--r--sysdeps/mach/hurd/recv.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/recv.c b/sysdeps/mach/hurd/recv.c
index 6dd556cc12..b9ed067265 100644
--- a/sysdeps/mach/hurd/recv.c
+++ b/sysdeps/mach/hurd/recv.c
@@ -21,6 +21,7 @@
 #include <hurd/fd.h>
 #include <hurd/socket.h>
 #include <string.h>
+#include <sysdep-cancel.h>
 
 /* Read N bytes into BUF from socket FD.
    Returns the number read or -1 for errors.  */
@@ -36,13 +37,17 @@ __recv (int fd, void *buf, size_t n, int flags)
   mach_msg_type_number_t nports = 0;
   char *cdata = NULL;
   mach_msg_type_number_t clen = 0;
+  int cancel_oldtype;
 
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
   err = HURD_DPORT_USE (fd, __socket_recv (port, &addrport,
 					       flags, &bufp, &nread,
 					       &ports, &nports,
 					       &cdata, &clen,
 					       &flags,
 					       n));
+  LIBC_CANCEL_RESET (cancel_oldtype);
+
   if (err == MIG_BAD_ID || err == EOPNOTSUPP)
     /* The file did not grok the socket protocol.  */
     err = ENOTSOCK;