/* Now print to helper instead. */
result = _IO_vfprintf (hp, format, args);
+ /* Lock stream. */
+ __libc_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, s);
+ _IO_flockfile (s);
+
/* Now flush anything from the helper to the S. */
if ((to_flush = hp->_IO_write_ptr - hp->_IO_write_base) > 0)
{
if ((int) _IO_sputn (s, hp->_IO_write_base, to_flush) != to_flush)
- return -1;
+ reesult = -1;
}
+ /* Unlock the stream. */
+ _IO_funlockfile (s);
+ __libc_cleanup_region_end (0);
+
return result;
}