This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: tell() changes the state of the file object which causes it


>   601: ftell() changes the state of the file object which causes it
> 

Again, this patch is for glibc 2.0.7. If it is ok, I can port it to
glibc 2.1.

BTW, it is very nice to work with a short, but complete, bug report.

Thanks.


H.J.
----
Thu Aug 20 17:54:43 1998  H.J. Lu  (hjl@gnu.org)

	* libio/fileops.c (_IO_file_seekoff): Don't adjust pointers if
	_IO_SYSSEEK fails.

Index: libio/fileops.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc-2.0/libio/fileops.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 fileops.c
--- fileops.c	1997/09/19 18:10:38	1.1.1.1
+++ fileops.c	1998/08/21 00:42:52
@@ -544,11 +544,13 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir
 
   _IO_unsave_markers(fp);
   result = _IO_SYSSEEK (fp, offset, dir);
-  if (result != EOF)
-    _IO_mask_flags(fp, 0, _IO_EOF_SEEN);
   fp->_offset = result;
-  _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
-  _IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base);
+  if (result != EOF)
+    {
+      _IO_mask_flags(fp, 0, _IO_EOF_SEEN);
+      _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+      _IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base);
+    }
   return result;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]