From: Alexey Bogdanenko Date: Thu, 6 Dec 2018 14:54:46 +0000 (+0300) Subject: test-resolved: fix error code check in assertion X-Git-Tag: v240~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=487e33242f899f41a74a8e5537416578f94ccdb6;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/resolve/test-resolved-etc-hosts.c b/src/resolve/test-resolved-etc-hosts.c index da10391d74e..6130a036fd0 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; }