summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-06-14 03:02:30 +0000
committerRoland McGrath <roland@gnu.org>2001-06-14 03:02:30 +0000
commitc0c71388a72ac59d6d3377e5902431bc888b73f6 (patch)
treeb9a63bd8243dba2baaeadf369be2b828363ca8d9 /sysdeps
parente418753ce9f82e7f4c85161d0097fcd5094bcc7b (diff)
downloadglibc-c0c71388a72ac59d6d3377e5902431bc888b73f6.tar.gz
glibc-c0c71388a72ac59d6d3377e5902431bc888b73f6.tar.xz
glibc-c0c71388a72ac59d6d3377e5902431bc888b73f6.zip
* sysdeps/mach/hurd/pread.c: Fail with EINVAL if OFFSET is negative.
	* sysdeps/mach/hurd/pwrite.c: Likewise.

	* shlib-versions [USE_IN_LIBIO] (.*-.*-gnu-gnu.*): libc=0.3
	[USE_IN_LIBIO && !GLIBC_OLDEST_ABI] (.*-.*-gnu-gnu.*): Use GLIBC_2.2.4
	as default version set.

	(test_ftello): Check for EFBIG and ENOSPC, clean up error messages.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/pread.c9
-rw-r--r--sysdeps/mach/hurd/pwrite.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/pread.c b/sysdeps/mach/hurd/pread.c
index 6c82846be6..dd69b10ac5 100644
--- a/sysdeps/mach/hurd/pread.c
+++ b/sysdeps/mach/hurd/pread.c
@@ -1,6 +1,6 @@
 /* Read block from given position in file without changing file pointer.
    Hurd version.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999,2001 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
@@ -25,8 +25,11 @@
 ssize_t
 __pread (int fd, void *buf, size_t nbytes, off_t offset)
 {
-  error_t err = HURD_FD_USE (fd, _hurd_fd_read (descriptor,
-						buf, &nbytes, offset));
+  error_t err;
+  if (offset < 0)
+    err = EINVAL;
+  else
+    err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, offset));
   return err ? __hurd_dfail (fd, err) : nbytes;
 }
 weak_alias (__pread, pread)
diff --git a/sysdeps/mach/hurd/pwrite.c b/sysdeps/mach/hurd/pwrite.c
index d307b47277..42de3eb9f9 100644
--- a/sysdeps/mach/hurd/pwrite.c
+++ b/sysdeps/mach/hurd/pwrite.c
@@ -1,6 +1,6 @@
 /* Write block at given position in file without changing file pointer.
    Hurd version.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999,2001 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
@@ -27,8 +27,11 @@
 ssize_t
 __pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
 {
-  error_t err = HURD_FD_USE (fd, _hurd_fd_write (descriptor,
-						 buf, &nbytes, 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;
 }
 weak_alias (__pwrite, pwrite)