diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-09-20 17:09:15 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-09-20 17:09:15 -0400 |
commit | 99a49c0add96bfb75a65ccebb922378f3975f7d9 (patch) | |
tree | f53f7d818fdb11a4cab0811077b77417c6b6c4a9 | |
parent | 2eb92b83a3b914f518f463f9330e185b43595450 (diff) | |
download | bfs-99a49c0add96bfb75a65ccebb922378f3975f7d9.tar.xz |
bftw: Fix bftw_cached_stat() with BFS_STAT_TRYFOLLOW
-rw-r--r-- | bftw.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -889,8 +889,12 @@ const struct bfs_stat *bftw_stat(const struct BFTW *ftwbuf, enum bfs_stat_flags const struct bfs_stat *bftw_cached_stat(const struct BFTW *ftwbuf, enum bfs_stat_flags flags) { if (flags & BFS_STAT_NOFOLLOW) { return ftwbuf->lstat_cache.buf; - } else { + } else if (ftwbuf->stat_cache.buf) { return ftwbuf->stat_cache.buf; + } else if ((flags & BFS_STAT_TRYFOLLOW) && is_nonexistence_error(ftwbuf->stat_cache.error)) { + return ftwbuf->lstat_cache.buf; + } else { + return NULL; } } |