From 5c81f5d68f03e07050b3d814f66a0008be0ef5f1 Mon Sep 17 00:00:00 2001 From: Paride Legovini Date: Thu, 3 May 2018 15:51:43 +0200 Subject: 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. --- core/text-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') 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"); } -- cgit v1.2.3