This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: My list of bugs I'd like to see fixed before 2.1
- To: aj@arthur.rhein-neckar.de (Andreas Jaeger)
- Subject: Re: My list of bugs I'd like to see fixed before 2.1
- From: hjl@lucon.org (H.J. Lu)
- Date: Sun, 29 Nov 1998 11:59:55 -0800 (PST)
- Cc: libc-hacker@cygnus.com (GNU C Library), tbittih@pal.xgw.fi
>
> - PR 673 is still unresolved. We had three months a short discussion
> about it (I can send everything if needed) but didn't come to any
> conclusion if glibc is broken or the test program is broken (and I
> didn't have time to push the discussion further). I'd appreciate if
> somebody could look again into it. Reading again through the emails
> it might be that glibc is broken.
>
I think glibc is broken. We don't need to sync a read-only fp there,
which may lead to a call to lseek. That will change the file offset
for the parent process. Here is a patch. BTW, the original patch in
PR 673 doesn't cover fopen (xxx, "r+").
--
H.J. Lu (hjl@gnu.org)
---
Sun Nov 29 11:55:16 1998 H.J. Lu <hjl@gnu.org>
* libio/genops.c (_IO_unbuffer_write): Renamed from
_IO_unbuffer_all.
(_IO_cleanup): Call _IO_unbuffer_write instead of
_IO_unbuffer_all.
Index: genops.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/libio/genops.c,v
retrieving revision 1.1.1.11
diff -u -p -r1.1.1.11 genops.c
--- genops.c 1998/11/06 15:27:05 1.1.1.11
+++ genops.c 1998/11/29 19:45:27
@@ -705,14 +705,16 @@ _IO_flush_all_linebuffered ()
_IO_OVERFLOW (fp, EOF);
}
-static void _IO_unbuffer_all __P ((void));
+static void _IO_unbuffer_write __P ((void));
static void
-_IO_unbuffer_all ()
+_IO_unbuffer_write ()
{
_IO_FILE *fp;
for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
- if (! (fp->_flags & _IO_UNBUFFERED))
+ if (! (fp->_flags & _IO_UNBUFFERED)
+ && (! (fp->_flags & _IO_NO_WRITES)
+ || (fp->_flags & _IO_IS_APPENDING)))
_IO_SETBUF (fp, NULL, 0);
}
@@ -728,7 +730,7 @@ _IO_cleanup ()
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_write ();
return result;
}