summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bftw.c14
-rw-r--r--tests/xtouch.c6
2 files changed, 19 insertions, 1 deletions
diff --git a/src/bftw.c b/src/bftw.c
index 0b74cd9..355cb54 100644
--- a/src/bftw.c
+++ b/src/bftw.c
@@ -739,10 +739,22 @@ static int bftw_file_open(struct bftw_state *state, struct bftw_file *file, cons
}
int fd = bftw_file_openat(state, file, base, at_path);
- if (fd >= 0 || errno != ENAMETOOLONG) {
+ if (fd >= 0) {
return fd;
}
+ switch (errno) {
+ case ENAMETOOLONG:
+#if __DragonFly__
+ // https://twitter.com/tavianator/status/1742991411203485713
+ case EFAULT:
+#endif
+ break;
+
+ default:
+ return -1;
+ }
+
// Handle ENAMETOOLONG by manually traversing the path component-by-component
struct bftw_list parents;
SLIST_INIT(&parents);
diff --git a/tests/xtouch.c b/tests/xtouch.c
index 260a3a3..ed8bbee 100644
--- a/tests/xtouch.c
+++ b/tests/xtouch.c
@@ -70,13 +70,19 @@ static int open_parent(const struct args *args, const char **path) {
switch (errno) {
case ENAMETOOLONG:
+#if __DragonFly__
+ // https://twitter.com/tavianator/status/1742991411203485713
+ case EFAULT:
+#endif
break;
+
case ENOENT:
if (args->flags & CREATE_PARENTS) {
break;
} else {
goto err;
}
+
default:
goto err;
}