summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-05-23 17:11:23 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-05-24 09:00:50 -0400
commitd9b3196d6c8f4fa0e7d0a4771040762edaebb1ee (patch)
treef378d6955cf3cd6817a47e3a95284441552b221e /eval.c
parent28bbaeac8058653a4a46ae439c37d251a550f4f9 (diff)
downloadbfs-d9b3196d6c8f4fa0e7d0a4771040762edaebb1ee.tar.xz
fsade: Refactor the POSIX.1e abstractions
Since we're going to want to abstract more things that aren't part of POSIX.1e (like xattrs) in a similar way, let's give this a more generic name. And while we're at it, give it some more precise error reporting, and add some tests.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 7a9a1aa..f07b380 100644
--- a/eval.c
+++ b/eval.c
@@ -25,8 +25,8 @@
#include "diag.h"
#include "dstring.h"
#include "exec.h"
+#include "fsade.h"
#include "mtab.h"
-#include "posix1e.h"
#include "printf.h"
#include "stat.h"
#include "trie.h"
@@ -160,14 +160,26 @@ bool eval_access(const struct expr *expr, struct eval_state *state) {
* -acl test.
*/
bool eval_acl(const struct expr *expr, struct eval_state *state) {
- return bfs_check_acl(state->ftwbuf);
+ int ret = bfs_check_acl(state->ftwbuf);
+ if (ret >= 0) {
+ return ret;
+ } else {
+ eval_report_error(state);
+ return false;
+ }
}
/**
* -capable test.
*/
bool eval_capable(const struct expr *expr, struct eval_state *state) {
- return bfs_check_capabilities(state->ftwbuf);
+ int ret = bfs_check_capabilities(state->ftwbuf);
+ if (ret >= 0) {
+ return ret;
+ } else {
+ eval_report_error(state);
+ return false;
+ }
}
/**