We were dropping back to the fallback stat (which turns into an fstatat() with O_NOFOLLOW) even when the return from fstatat() indicated -ENOENT or -ELOOP, which should be preserved unchanged so that the caller can print 'L' or 'N' accordingly.
* find/util.c (optionl_stat): Do not use the fallback stat when -ENOENT or -ELOOP are encountered. --- ChangeLog | 5 +++++ find/util.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7f240a6..975c55d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-06 Nick Alcock <[email protected]> + + * find/util.c (optionl_stat): Do not use the fallback stat + when -ENOENT or -ELOOP are encountered. + 2011-12-30 Karl Berry <[email protected]> Documentation improvements (UK spelling, use of @code). diff --git a/find/util.c b/find/util.c index 94e9549..e489b44 100644 --- a/find/util.c +++ b/find/util.c @@ -627,6 +627,10 @@ optionl_stat(const char *name, struct stat *p) rv = fstatat (state.cwd_dir_fd, name, p, 0); if (0 == rv) return 0; /* normal case. */ + else if ((-1 == rv) && + ((errno == ENOENT) || + (errno == ELOOP))) + return -1; else return fallback_stat (name, p, rv); } -- 1.7.10.4.153.g8c399cf
