aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2025-07-02 10:22:21 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2025-07-02 10:22:29 +0000
commit5e96f4006d2e5f165531a53b6c1393a1c7604f42 (patch)
tree5b7e7879f00e24e3fdc548ec7da822da3ea16485 /lib
parent8d02b7190d3b926118fafc6a70a80676c349e186 (diff)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/opendir2.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/libc/gen/opendir2.c b/lib/libc/gen/opendir2.c
index 30a9030693e4..b9ac23e6d9fd 100644
--- a/lib/libc/gen/opendir2.c
+++ b/lib/libc/gen/opendir2.c
@@ -243,20 +243,18 @@ _filldir(DIR *dirp, bool use_current_pos)
return (true);
}
+/*
+ * Return true if the file descriptor is associated with a file from a
+ * union file system or from a file system mounted with the union flag.
+ */
static bool
is_unionstack(int fd)
{
- int unionstack;
-
- unionstack = _fcntl(fd, F_ISUNIONSTACK, 0);
- if (unionstack != -1)
- return (unionstack);
-
/*
- * Should not happen unless running on a kernel without the op,
- * but no use rendering the system useless in such a case.
+ * This call shouldn't fail, but if it does, just assume that the
+ * answer is no.
*/
- return (0);
+ return (_fcntl(fd, F_ISUNIONSTACK, 0) > 0);
}
/*