summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-01-02 21:13:23 -0700
committerTavian Barnes <tavianator@tavianator.com>2017-01-02 21:13:23 -0700
commit9f297d68f5bf80eed89feb7dbf465339f62d8ba0 (patch)
tree3d3f69415979ea4fd7568947425cc5a833dc7571
parent4cc0235673e0b305293b58ae90f1312f1d912a09 (diff)
downloadbfs-9f297d68f5bf80eed89feb7dbf465339f62d8ba0.tar.xz
eval: Check that O_DIRECTORY is defined before using it
-rw-r--r--eval.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index b260ad9..0946dcc 100644
--- a/eval.c
+++ b/eval.c
@@ -488,7 +488,11 @@ bool eval_empty(const struct expr *expr, struct eval_state *state) {
struct BFTW *ftwbuf = state->ftwbuf;
if (ftwbuf->typeflag == BFTW_DIR) {
- int dfd = openat(ftwbuf->at_fd, ftwbuf->at_path, O_DIRECTORY);
+ int flags = 0;
+#ifdef O_DIRECTORY
+ flags |= O_DIRECTORY;
+#endif
+ int dfd = openat(ftwbuf->at_fd, ftwbuf->at_path, flags);
if (dfd < 0) {
eval_error(state);
goto done;