aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-03-26 14:54:59 -0700
committerRob Landley <rob@landley.net>2019-03-26 19:06:58 -0500
commitbcb06e3244808e2ced0de2a39a348a7ddb7c54f2 (patch)
treedeb7c54debabc081d3fe286ea87d30317a89f533
parentd78f05e91bb3a87a73b1d3fad29362447ee8e1f6 (diff)
downloadtoybox-bcb06e3244808e2ced0de2a39a348a7ddb7c54f2.tar.gz
xabspath: use O_PATH.
SELinux on Android is unhappy if you try to read "/": avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0 O_PATH seems more intention-revealing anyway.
-rw-r--r--lib/xwrap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index a8214e57..2e2ccbc1 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -521,7 +521,7 @@ void xstat(char *path, struct stat *st)
char *xabspath(char *path, int exact)
{
struct string_list *todo, *done = 0;
- int try = 9999, dirfd = open("/", 0), missing = 0;
+ int try = 9999, dirfd = open("/", O_PATH), missing = 0;
char *ret;
// If this isn't an absolute path, start with cwd.