summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-06-03 18:34:01 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-06-03 18:34:01 -0400
commit32d252598e855829ebdc657e635f93270600b5a2 (patch)
tree32da4f1dc5d66cd6600fe427a8ca4a45309cef9f /src
parent6fcc0f217e3352e4f935f3e66a62c1cf7073dcb9 (diff)
parent9e408d4bb50cb7c4e9d0a007b95f9fb9d32a16d0 (diff)
downloadbfs-32d252598e855829ebdc657e635f93270600b5a2.tar.xz
Merge branch 'revert-eloop'
Diffstat (limited to 'src')
-rw-r--r--src/bfstd.c2
-rw-r--r--src/eval.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/bfstd.c b/src/bfstd.c
index 1c5e289..44eda7c 100644
--- a/src/bfstd.c
+++ b/src/bfstd.c
@@ -44,7 +44,7 @@ bool error_is_like(int error, int category) {
switch (category) {
case ENOENT:
- return error == ENOTDIR || error == ELOOP;
+ return error == ENOTDIR;
case ENOSYS:
// https://github.com/opencontainers/runc/issues/2151
diff --git a/src/eval.c b/src/eval.c
index c0fe6ca..0b5992e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -999,6 +999,13 @@ bool eval_xtype(const struct bfs_expr *expr, struct bfs_eval *state) {
const struct BFTW *ftwbuf = state->ftwbuf;
enum bfs_stat_flags flags = ftwbuf->stat_flags ^ (BFS_STAT_NOFOLLOW | BFS_STAT_TRYFOLLOW);
enum bfs_type type = bftw_type(ftwbuf, flags);
+
+ // GNU find treats ELOOP as a broken symbolic link for -xtype l
+ // (but not -L -type l)
+ if ((flags & BFS_STAT_TRYFOLLOW) && type == BFS_ERROR && errno == ELOOP) {
+ type = BFS_LNK;
+ }
+
if (type == BFS_ERROR) {
eval_report_error(state);
return false;