aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-11-09 07:04:08 +0000
committerUlrich Drepper <drepper@redhat.com>2004-11-09 07:04:08 +0000
commiteca29725d15f200f3eb8b106bb7bac3fb687fa74 (patch)
tree3e02a6a8300bc0177a90a2e3853d9b5ad8bcc85e
parent936668d369d40eeeffb4cddd1b8c8cc21415f754 (diff)
downloadglibc-eca29725d15f200f3eb8b106bb7bac3fb687fa74.tar
glibc-eca29725d15f200f3eb8b106bb7bac3fb687fa74.tar.gz
glibc-eca29725d15f200f3eb8b106bb7bac3fb687fa74.tar.bz2
glibc-eca29725d15f200f3eb8b106bb7bac3fb687fa74.zip
(_IO_new_file_seekoff): If mode is 0 and fp->_offset == _IO_pos_BAD, just call _IO_SYSSEEK (fp, 0, dir) and if successful set fp->_offset.
-rw-r--r--libio/fileops.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 08eff0a08e..2d787d296f 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -989,7 +989,18 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
/* Adjust for read-ahead (bytes is buffer). */
offset -= fp->_IO_read_end - fp->_IO_read_ptr;
if (fp->_offset == _IO_pos_BAD)
- goto dumb;
+ {
+ if (mode != 0)
+ goto dumb;
+ else
+ {
+ result = _IO_SYSSEEK (fp, 0, dir);
+ if (result == EOF)
+ return result;
+
+ fp->_offset = result;
+ }
+ }
/* Make offset absolute, assuming current pointer is file_ptr(). */
offset += fp->_offset;
if (offset < 0)