vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit f2658ca7017b0ec80367ef8569c498fc50e9c53b
parent ad873230f4b1933886006329585ed022494f229a
Author: Paride Legovini <pl@ninthfloor.org>
Date:   Thu,  3 May 2018 15:51:43 +0200

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.

Diffstat:
Mcore/text-test.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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"); }