aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParide Legovini <pl@ninthfloor.org>2018-05-03 15:51:43 +0200
committerParide Legovini <pl@ninthfloor.org>2018-05-03 15:51:43 +0200
commit5c81f5d68f03e07050b3d814f66a0008be0ef5f1 (patch)
tree7acba7ea024dcc46d07c581b233a68169bc0cf0e
parentc45d21d433f5dfb477031289936430322d00920c (diff)
downloadvis-5c81f5d68f03e07050b3d814f66a0008be0ef5f1.tar.gz
vis-5c81f5d68f03e07050b3d814f66a0008be0ef5f1.tar.xz
Check that /etc/shadow is actually not readable
In some chrooted build enviroments the build/test process runs with UID=0. In these cases the "Opening file without sufficient permissions" test fails, as /etc/shadow is readable. Let's perform it only if it is actually not readable.
-rw-r--r--core/text-test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/text-test.c b/core/text-test.c
index 1d8eefe..d6abdeb 100644
--- a/core/text-test.c
+++ b/core/text-test.c
@@ -97,7 +97,7 @@ int main(int argc, char *argv[]) {
txt = text_load("/");
ok(txt == NULL && errno == EISDIR, "Opening directory");
- if (access("/etc/shadow", F_OK) == 0) {
+ if (access("/etc/shadow", F_OK) == 0 && access("/etc/shadow", R_OK) != 0) {
txt = text_load("/etc/shadow");
ok(txt == NULL && errno == EACCES, "Opening file without sufficient permissions");
}