]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(buffered_vfprintf): Add locking.
authorUlrich Drepper <drepper@redhat.com>
Fri, 9 Jul 1999 22:26:18 +0000 (22:26 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 9 Jul 1999 22:26:18 +0000 (22:26 +0000)
stdio-common/vfprintf.c

index 263b0238c7b5abdc099d4276dba028188eebb098..db83a6a7b02f311a446768d5188f57a9ced85025 100644 (file)
@@ -1746,13 +1746,21 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
   /* 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;
 }