diff options
Diffstat (limited to 'sysdeps/mach/hurd/pread.c')
-rw-r--r-- | sysdeps/mach/hurd/pread.c | 9 |
1 files changed, 6 insertions, 3 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) |