about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/read.c')
-rw-r--r--sysdeps/mach/hurd/read.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/read.c b/sysdeps/mach/hurd/read.c
index 2e8f92a542..00e574e6d1 100644
--- a/sysdeps/mach/hurd/read.c
+++ b/sysdeps/mach/hurd/read.c
@@ -15,16 +15,18 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <unistd.h>
-#include <hurd/fd.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
 
 /* Read NBYTES into BUF from FD.  Return the number read or -1.  */
 ssize_t
 __libc_read (int fd, void *buf, size_t nbytes)
 {
-  error_t err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, -1));
-  return err ? __hurd_dfail (fd, err) : nbytes;
+  ssize_t ret;
+  int cancel_oldtype = LIBC_CANCEL_ASYNC();
+  ret = __read_nocancel (fd, buf, nbytes);
+  LIBC_CANCEL_RESET (cancel_oldtype);
+  return ret;
 }
 libc_hidden_def (__libc_read)
 weak_alias (__libc_read, __read)