summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2014-12-08 15:13:38 +0100
committerAndreas Schwab <schwab@suse.de>2014-12-10 15:58:22 +0100
commit217a74a85cdd60df236c296ad88142b78d35eccf (patch)
tree278502d0ed6e8a84d076725f917443585c4631f9 /sysdeps
parentaa76a5c7010e98c737d79f37aa6ae668f60f7a00 (diff)
downloadglibc-217a74a85cdd60df236c296ad88142b78d35eccf.tar.gz
glibc-217a74a85cdd60df236c296ad88142b78d35eccf.tar.xz
glibc-217a74a85cdd60df236c296ad88142b78d35eccf.zip
Don't touch user-controlled stdio locks in forked child (bug 12847)
The stdio locks for streams with the _IO_USER_LOCK flag should not be
touched by internal code.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/nptl/fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index a7dafa82ab..7ef693d529 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -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));
 }