[patch] Fix failure to cleanup input-only stream buffers in preparation for BZ#16734 fix

Paul Pluzhnikov ppluzhnikov@gmail.com
Tue Feb 17 01:07:00 GMT 2015


Greetings,

In preparation for BZ#16734 fix, I've build libc with (not intended to commit):

diff --git a/libio/libioP.h b/libio/libioP.h
index d8604ca..d1699de 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -719,7 +719,7 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE
*, _IO_off64_t, int)
 # endif
 #endif

-#if _G_HAVE_MMAP
+#if _G_HAVE_MMAP && 0

 # include <unistd.h>
 # include <fcntl.h>
... etc.

This results in 3 mtrace failures:

FAIL: misc/tst-error1-mem
FAIL: posix/bug-regex31-mem
FAIL: posix/tst-fnmatch-mem

The last two of them are because input-only FILE streams need the same
buffer cleanup as writable streams.

Attached patch fixes these two failures.


2015-02-16  Paul Pluzhnikov  <ppluzhnikov@google.com>

        * libio/genops.c (_IO_unbuffer_write): Cleanup read-only
streams as well.



-- 
Paul Pluzhnikov
-------------- next part --------------
diff --git a/libio/genops.c b/libio/genops.c
index 6612997..094598f 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -950,8 +950,6 @@ _IO_unbuffer_write (void)
   for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
     {
       if (! (fp->_flags & _IO_UNBUFFERED)
-	  && (! (fp->_flags & _IO_NO_WRITES)
-	      || (fp->_flags & _IO_IS_APPENDING))
 	  /* Iff stream is un-orientated, it wasn't used. */
 	  && fp->_mode != 0)
 	{


More information about the Libc-alpha mailing list