From: Ulrich Drepper Date: Thu, 11 Feb 2010 04:31:48 +0000 (-0800) Subject: Fix file descriotor leak in nftw with FTW_CHDIR X-Git-Tag: fedora/glibc-2.11.1-7~1^2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69ad8afe74aa5a0aa727553e010ad0dded7721dd;p=thirdparty%2Fglibc.git Fix file descriotor leak in nftw with FTW_CHDIR (cherry picked from commit 247fdf2e2b798378d8aeaac1ee6f4ba0a49f31f3) --- diff --git a/ChangeLog b/ChangeLog index a63f1b90367..6a0f4c0a70a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-02-10 Ulrich Drepper + + [BZ #11271] + * io/ftw.c (ftw_startup): Close descriptor for initial directory + after changing back to it. + 2010-02-09 Ulrich Drepper * sysdeps/i386/lshift.S: Fix unwind information. diff --git a/io/ftw.c b/io/ftw.c index 9cc09077ed1..bb7dba8ca87 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -1,5 +1,5 @@ /* File tree walker functions. - Copyright (C) 1996-2004, 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2006-2008, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -790,6 +790,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, { int save_err = errno; __fchdir (cwdfd); + close_not_cancel_no_status (cwdfd); __set_errno (save_err); } else if (cwd != NULL)