diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2017-01-02 21:13:23 -0700 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2017-01-02 21:13:23 -0700 |
commit | 9f297d68f5bf80eed89feb7dbf465339f62d8ba0 (patch) | |
tree | 3d3f69415979ea4fd7568947425cc5a833dc7571 /eval.c | |
parent | 4cc0235673e0b305293b58ae90f1312f1d912a09 (diff) | |
download | bfs-9f297d68f5bf80eed89feb7dbf465339f62d8ba0.tar.xz |
eval: Check that O_DIRECTORY is defined before using it
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |