summary refs log tree commit diff
path: root/sysdeps/mach/hurd/pwrite64.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/pwrite64.c')
-rw-r--r--sysdeps/mach/hurd/pwrite64.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sysdeps/mach/hurd/pwrite64.c b/sysdeps/mach/hurd/pwrite64.c
index 9f15fb5a7c..9d27ae01e6 100644
--- a/sysdeps/mach/hurd/pwrite64.c
+++ b/sysdeps/mach/hurd/pwrite64.c
@@ -1,6 +1,6 @@
 /* Write block to given position in file without changing file pointer.
    Hurd version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,21 +20,17 @@
 
 #include <errno.h>
 #include <unistd.h>
+#include <hurd/fd.h>
 
 ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t nbyte, off64_t offset)
+__libc_pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset)
 {
-  /* XXX We don't really support large files on the Hurd.  So if
-     OFFSET doesn't fit in an `off_t', we'll return `-1' and set
-     errno.  EOVERFLOW probably isn't the right error value, but seems
-     appropriate here.  */
-  if ((off_t) offset != offset)
-    {
-      __set_errno (EOVERFLOW);
-      return -1;
-    }
-
-  return __libc_pwrite (fd, buf, nbyte, offset);
+  error_t err;
+  if (offset < 0)
+    err = EINVAL;
+  else
+    err = HURD_FD_USE (fd, _hurd_fd_write (descriptor, buf, &nbytes, offset));
+  return err ? __hurd_dfail (fd, err) : nbytes;
 }
 
 #ifndef __libc_pwrite64