git: DragonFly_RELEASE_4_6 libc - Fix more popen() issues

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Jul 28 18:27:12 PDT 2016


commit 5b715746eadfbbefb248f3b5be0227766b4b757b
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/5b715746eadfbbefb248f3b5be0227766b4b757b


-- 
DragonFly BSD source repository



More information about the Commits mailing list