From 487e33242f899f41a74a8e5537416578f94ccdb6 Mon Sep 17 00:00:00 2001 From: Alexey Bogdanenko Date: Thu, 6 Dec 2018 17:54:46 +0300 Subject: [PATCH] test-resolved: fix error code check in assertion If file "/etc/hosts" does not exist, fopen fails and sets errno to ENOENT ("No such file or directory"). So errno should be compared with ENOENT. This mistake causes test test-resolved-etc-hosts to fail when run on Debian image built with mkosi.debian included in the repo. The image does not include "/etc/hosts" file as it is not created by debootstrap, see debootstrap manpage https://manpages.debian.org/stretch/debootstrap/debootstrap.8.en.html. --- src/resolve/test-resolved-etc-hosts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolve/test-resolved-etc-hosts.c b/src/resolve/test-resolved-etc-hosts.c index da10391d74..6130a036fd 100644 --- a/src/resolve/test-resolved-etc-hosts.c +++ b/src/resolve/test-resolved-etc-hosts.c @@ -11,7 +11,7 @@ static void test_parse_etc_hosts_system(void) { f = fopen("/etc/hosts", "re"); if (!f) { - assert_se(errno == -ENOENT); + assert_se(errno == ENOENT); return; }