Don't touch user-controlled stdio locks in forked child (bug 12847)
authorAndreas Schwab <schwab@suse.de>
Mon, 8 Dec 2014 14:13:38 +0000 (15:13 +0100)
committerAndreas Schwab <schwab@suse.de>
Wed, 10 Dec 2014 14:58:22 +0000 (15:58 +0100)
The stdio locks for streams with the _IO_USER_LOCK flag should not be
touched by internal code.

ChangeLog
sysdeps/nptl/fork.c

index 03bba82..c2d99a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-10  Andreas Schwab  <schwab@suse.de>
+
+       [BZ #12847]
+       * sysdeps/nptl/fork.c (fresetlockfiles): Skip files with
+       user-controlled locks.
+
 2014-12-10  Richard Earnshaw  <rearnsha@arm.com>
 
        * sysdeps/aarch64/strchrnul.S (vrepmask): Use a call-clobbered
index a7dafa8..7ef693d 100644 (file)
@@ -46,7 +46,8 @@ fresetlockfiles (void)
   _IO_ITER i;
 
   for (i = _IO_iter_begin(); i != _IO_iter_end(); i = _IO_iter_next(i))
-    _IO_lock_init (*((_IO_lock_t *) _IO_iter_file(i)->_lock));
+    if ((_IO_iter_file (i)->_flags & _IO_USER_LOCK) == 0)
+      _IO_lock_init (*((_IO_lock_t *) _IO_iter_file(i)->_lock));
 }