From d9b3196d6c8f4fa0e7d0a4771040762edaebb1ee Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 23 May 2019 17:11:23 -0400 Subject: 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. --- eval.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'eval.c') 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; + } } /** -- cgit v1.2.3