From: Zbigniew Jędrzejewski-Szmek Date: Tue, 4 Feb 2020 07:30:40 +0000 (+0100) Subject: test-network: do not fail if lo has a .network file X-Git-Tag: v245-rc1~19^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e519e20ae16e24438c0be0d3bc6eed953a55d9ed;p=thirdparty%2Fsystemd.git test-network: do not fail if lo has a .network file Fixes #9895. --- diff --git a/src/network/test-network.c b/src/network/test-network.c index 7c37563ac22..b29523b3182 100644 --- a/src/network/test-network.c +++ b/src/network/test-network.c @@ -122,11 +122,18 @@ static int test_load_config(Manager *manager) { static void test_network_get(Manager *manager, sd_device *loopback) { Network *network; const struct ether_addr mac = ETHER_ADDR_NULL; + int r; - /* let's assume that the test machine does not have a .network file - that applies to the loopback device... */ - assert_se(network_get(manager, loopback, "lo", NULL, &mac, &mac, 0, NULL, NULL, &network) == -ENOENT); - assert_se(!network); + /* Let's hope that the test machine does not have a .network file that applies to loopback device… + * But it is still possible, so let's allow that case too. */ + r = network_get(manager, loopback, "lo", NULL, &mac, &mac, 0, NULL, NULL, &network); + if (r == -ENOENT) + /* The expected case */ + assert_se(!network); + else if (r >= 0) + assert_se(network); + else + assert_not_reached("bad error!"); } static void test_address_equality(void) {