summaryrefslogtreecommitdiff
path: root/lib/fts.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-01-10 11:55:13 +0000
committerJim Meyering <jim@meyering.net>2006-01-10 11:55:13 +0000
commit58e925ce5fa24f2c37907a2bf1a39fd494ce86fd (patch)
treef8e6e728efc04e38eca2b6120f53e18ca427c7f1 /lib/fts.c
parentf26f53be9c08d068fe4a71e13e507a973997ac82 (diff)
downloadcoreutils-58e925ce5fa24f2c37907a2bf1a39fd494ce86fd.tar.xz
Avoid the double-free (first in fts_read, second in fts_close) that
would occur when an `active' directory is made inaccessible (e.g., via chmod a-x) during a traversal. (fts_read): After a failed fchdir, update sp->fts_cur before returning. Reproduce this failure by mkdir -p a/b; cd a; chmod a-x . b Reported by Stavros Passas.
Diffstat (limited to 'lib/fts.c')
-rw-r--r--lib/fts.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/fts.c b/lib/fts.c
index ed09697e0..fb1a72a00 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -522,6 +522,7 @@ next: tmp = p;
if (p->fts_level == FTS_ROOTLEVEL) {
if (FCHDIR(sp, sp->fts_rfd)) {
SET(FTS_STOP);
+ sp->fts_cur = p;
return (NULL);
}
fts_load(sp, p);