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: hounddog.cc


Geoff Keating <geoffk@ozemail.com.au> writes:

|> The problem seems to be somewhere in libio.

Yes.  It's here:

	* libio/genops.c (_IO_switch_to_main_get_area): Swap _IO_read_ptr
	and _IO_save_ptr.
	(_IO_switch_to_backup_area): Save _IO_read_ptr in _IO_save_ptr.

Unfortunately, Ulrich never documents his changes, so i cannot even guess
what this is supposed to fix, and it clearly contradicts the documented
purpose of the function.  However removing this change fixes the bug.

Andreas.


1998-10-24  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* libio/genops.c (_IO_switch_to_main_get_area): Undo last change.
	It doesn't match the documented behaviour.
	(_IO_switch_to_backup_area): Don't set _IO_save_ptr.
	* libio/libio.h (struct _IO_FILE_complete): Remove _IO_save_ptr.

--- libc-2.1/libio/genops.c.~1~	Mon Sep 21 18:14:14 1998
+++ libc-2.1/libio/genops.c	Sat Oct 24 19:21:22 1998
@@ -94,10 +94,8 @@
   tmp = fp->_IO_read_base;
   fp->_IO_read_base = fp->_IO_save_base;
   fp->_IO_save_base = tmp;
-  /* Swap _IO_read_base and _IO_save_ptr. */
-  tmp = fp->_IO_read_ptr;
-  fp->_IO_read_ptr = fp->_IO_save_ptr;
-  fp->_IO_save_ptr = tmp;
+  /* Set _IO_read_ptr. */
+  fp->_IO_read_ptr = fp->_IO_read_base;
 }
 
 /* Switch current get area from main get area to (end of) backup area. */
@@ -112,12 +110,11 @@
   tmp = fp->_IO_read_end;
   fp->_IO_read_end = fp->_IO_save_end;
   fp->_IO_save_end = tmp;
-  /* Swap _gbase and _IO_save_base. */
+  /* Swap _IO_read_base and _IO_save_base. */
   tmp = fp->_IO_read_base;
   fp->_IO_read_base = fp->_IO_save_base;
   fp->_IO_save_base = tmp;
-  /* read _IO_read_ptr.  */
-  fp->_IO_save_ptr = fp->_IO_read_ptr;
+  /* Set _IO_read_ptr.  */
   fp->_IO_read_ptr = fp->_IO_read_end;
 }
 
--- libc-2.1/libio/libio.h.~1~	Wed Sep 30 18:10:06 1998
+++ libc-2.1/libio/libio.h	Sat Oct 24 19:23:14 1998
@@ -231,9 +231,8 @@
 #endif
 #if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
   _IO_off64_t _offset;
-  char *_IO_save_ptr;
   /* Make sure we don't get into trouble again.  */
-  char _unused2[16 * sizeof (int) - sizeof (char *)];
+  char _unused2[16 * sizeof (int)];
 #endif
 };
 


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