From 69fd52bd5c7c4f71629a9a756548bc02ef8905db Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 3 Nov 2009 14:14:53 +0100 Subject: [PATCH] fts: do not fail on a submount during traversal * lib/fts.c (fts_build): Read the stat info again after opening a directory. Original report at http://bugzilla.redhat.com/501848. --- ChangeLog | 7 +++++++ lib/fts.c | 11 +++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 239ec70..406749c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-11-03 Kamil Dudka + + fts: do not fail on a submount during traversal + * lib/fts.c (fts_build): Read the stat info again after opening + a directory. + Original report at http://bugzilla.redhat.com/501848. + 2009-11-03 Jim Meyering test-getaddrinfo: avoid compilation failure on FreeBSD 7.2 diff --git a/lib/fts.c b/lib/fts.c index 40a837e..d0715cf 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -1268,6 +1268,17 @@ fts_build (register FTS *sp, int type) opening it. */ if (cur->fts_info == FTS_NSOK) cur->fts_info = fts_stat(sp, cur, false); + else { + /* Now read the stat info again after opening a directory to reveal + * eventual changes caused by a submount triggered by the traverse. */ + LEAVE_DIR (sp, cur, "4"); + fts_stat (sp, cur, false); + if (! enter_dir (sp, cur)) + { + __set_errno (ENOMEM); + return NULL; + } + } /* * Nlinks is the number of possible entries of type directory in the -- 1.6.2.5