summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-04-19 15:14:09 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-04-19 15:50:45 -0400
commitc35d0c2ed5578b180e17c37588a047fd013cc619 (patch)
treeb2ffc5b1329c886ca25797c88faaaff0094439f2
parent48d91c62cd27c15fe0e928abf6d023d17e9c41f7 (diff)
downloadbfs-c35d0c2ed5578b180e17c37588a047fd013cc619.tar.xz
config: Check for struct stat::st_flags
-rw-r--r--config/header.mk1
-rw-r--r--config/st-flags.c9
-rw-r--r--src/stat.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/config/header.mk b/config/header.mk
index 5b6ff11..06b8f7f 100644
--- a/config/header.mk
+++ b/config/header.mk
@@ -24,6 +24,7 @@ HEADERS := \
${GEN}/st-acmtimespec.h \
${GEN}/st-birthtim.h \
${GEN}/st-birthtimespec.h \
+ ${GEN}/st-flags.h \
${GEN}/statx.h \
${GEN}/statx-syscall.h \
${GEN}/strerror-l.h \
diff --git a/config/st-flags.c b/config/st-flags.c
new file mode 100644
index 0000000..b1d0c32
--- /dev/null
+++ b/config/st-flags.c
@@ -0,0 +1,9 @@
+// Copyright © Tavian Barnes <tavianator@tavianator.com>
+// SPDX-License-Identifier: 0BSD
+
+#include <sys/stat.h>
+
+int main(void) {
+ struct stat sb = {0};
+ return sb.st_flags;
+}
diff --git a/src/stat.c b/src/stat.c
index a32dbaa..f5cf3fe 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -99,7 +99,7 @@ void bfs_stat_convert(struct bfs_stat *dest, const struct stat *src) {
dest->rdev = src->st_rdev;
dest->mask |= BFS_STAT_RDEV;
-#if BSD
+#if BFS_HAS_ST_FLAGS
dest->attrs = src->st_flags;
dest->mask |= BFS_STAT_ATTRS;
#endif