git: libc - Fix more popen() issues

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Jul 28 10:28:32 PDT 2016


commit 6be058eebc5e111cbd6a27d868d172241f95cdfb
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Jul 28 10:03:08 2016 -0700

    libc - Fix more popen() issues
    
    * Fix a file descriptor leak between popen() and pclose() in a threaded
      environment.  The control structure is removed from the list, then the
      list is unlocked, then the file is closed.  This can race a popen
      inbetween the unlock and the closure.
    
    * Do not use fileno() inside vfork, it is a complex function in a threaded
      environment which could lead to corruption since the vfork()'s lwp id may
      clash with one from the parent process.

Summary of changes:
 lib/libc/gen/popen.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6be058eebc5e111cbd6a27d868d172241f95cdfb


-- 
DragonFly BSD source repository



More information about the Commits mailing list