mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-30 20:35:03 +01:00
In fts_build(), if we try to chdir and fail (e.g. due to lack of search
permission), try to continue in FTS_DONTCHDIR mode. Of course this
won't work for long paths, but we can't descend more than one pathname
component beyond the directory anyway if we lack search permission.
Here is a transcript demonstrating the change, where oldls is ls(1)
linked with the old fts(3):
das@VARK:~> mkdir t && touch t/{a,b,c} && chmod u-x t
das@VARK:~> oldls t
a b c
das@VARK:~> oldls -l t
das@VARK:~> \ls t
a b c
das@VARK:~> \ls -l t
ls: a: Permission denied
ls: b: Permission denied
ls: c: Permission denied
I had forgotten about this patch until bde reminded me. He reports
using it without problems for over a year.
PR: 45723
This commit is contained in:
1 parent
92a5b2ee71
commit
1e03bff7f2
2 files changed
-4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130233
No files matched your search
@@ -710,8 +710,6 @@ fts_build(sp, type)
|
||||
cur->fts_flags |= FTS_DONTCHDIR;
|
||||
descend = 0;
|
||||
cderrno = errno;
|
||||
(void)closedir(dirp);
|
||||
dirp = NULL;
|
||||
} else
|
||||
descend = 1;
|
||||
} else
|
||||
|
||||
@@ -710,8 +710,6 @@ fts_build(sp, type)
|
||||
cur->fts_flags |= FTS_DONTCHDIR;
|
||||
descend = 0;
|
||||
cderrno = errno;
|
||||
(void)closedir(dirp);
|
||||
dirp = NULL;
|
||||
} else
|
||||
descend = 1;
|
||||
} else
|
||||
|
||||
Reference in new issue
Block a user