about summary refs log tree commit diff
path: root/io/ftw.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-02-10 20:31:48 -0800
committerUlrich Drepper <drepper@redhat.com>2010-02-10 20:31:48 -0800
commit247fdf2e2b798378d8aeaac1ee6f4ba0a49f31f3 (patch)
treeffb43177d57ec06e5a45781e025395d7a8a344a8 /io/ftw.c
parent311927f1bd58b6e2b36e3bbb83bbc4dbdb507155 (diff)
downloadglibc-247fdf2e2b798378d8aeaac1ee6f4ba0a49f31f3.tar.gz
glibc-247fdf2e2b798378d8aeaac1ee6f4ba0a49f31f3.tar.xz
glibc-247fdf2e2b798378d8aeaac1ee6f4ba0a49f31f3.zip
Fix file descriotor leak in nftw with FTW_CHDIR
Diffstat (limited to 'io/ftw.c')
-rw-r--r--io/ftw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/io/ftw.c b/io/ftw.c
index 9cc09077ed..bb7dba8ca8 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 <drepper@cygnus.com>, 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)