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: _IO_unbuffer_all corrupts parent process's buffers


On 22 Aug 1998, Andreas Jaeger wrote:

> 
> Hi Tuomas,
> 
> HJ Lu is trying to look into the bug report you've send us:
> >Number:         673
> >Synopsis:       _IO_unbuffer_all corrupts parent process's buffers
> 
> He has some problems with your testcase.  Please send him directly a
> complete testcase.  I'm appending his message for details.
> 

Well I'm kinda busy nowadays but I'll try to do something tomorrow...
meanwhile I've been using this kinda patch for genops.c to make these old 
libc5:ish programs work with glibc2 too...

--- /usr/src/glibc-2.0.7pre3/libio/genops.c     Fri Apr 18 02:21:30 1997
+++ ../fork_debug_local/genops.c.fixed  Sat Aug 22 16:12:17 1998
@@ -619,12 +619,17 @@
       _IO_OVERFLOW (fp, EOF);
 }

+/*
+ * 1998-06-22 / Tuomas Heino <tbittih@pal.xgw.fi>:
+ * _IO_SETBUF (fp, NULL,0) breaks parent process's input buffers
+ * ... only _IO_cleanup seems to be calling unbuffer_all ... let's 
rename it
+ */
 void
-DEFUN_VOID(_IO_unbuffer_all)
+DEFUN_VOID(_IO_unbuffer_all_except_input)
 {
   _IO_FILE *fp;
   for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
-    if (! (fp->_flags & _IO_UNBUFFERED))
+    if (! (fp->_flags & (_IO_UNBUFFERED|_IO_NO_WRITES)))
       _IO_SETBUF (fp, NULL, 0);
 }

@@ -640,7 +645,7 @@

      The following will make the standard streambufs be unbuffered,
      which forces any output from late destructors to be written out. */
-  _IO_unbuffer_all ();
+  _IO_unbuffer_all_except_input ();
 }

 void

... the symlink stuff is there just to make overriding genops.c easier 
and the #include "exit.h" isn't needed in simple.c - the problem was 
child's exit() corrupting parent's input stream positions... I'm in a 
hurry now but I think I'll look at this thing again tomorrow ;)


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