Re: fork() memory corruption - PATCH for glibc2 (was Re: fork() memory corruption... is this glibc2

Tuomas Heino (tbittih@xgw.fi)
Mon, 22 Jun 1998 13:17:19 +0300 (EET DST)


I think I found it... any comments on the following patch?

--- src/glibc-2.0.7pre3/libio/genops.c Fri Apr 18 02:21:30 1997
+++ genops.c.fixed Mon Jun 22 13:07:04 1998
@@ -619,16 +619,21 @@
_IO_OVERFLOW (fp, EOF);
}

+/*
+ * 1998-06-22 / Tuomas Heino <tbittih@pal.xgw.fi>:
+ * _IO_SETBUF (fp, NULL,0) breaks parent process's stdin
+ * ... 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);
}

-void
+void
DEFUN_VOID(_IO_cleanup)
{
_IO_flush_all ();
@@ -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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu