summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-06-02 19:59:37 +0200
committerThomas Haller <thaller@redhat.com>2017-06-02 20:00:56 +0200
commitc7c47575ce57d37037d20756cba7ed4af2f6c6bd (patch)
tree8a864ba591d886a3e41fbc2db3e10e3727190648
parent6f1ea8b8eeea8229b013cfeb1c4f446b0eb85e73 (diff)
downloadNetworkManager-c7c47575ce57d37037d20756cba7ed4af2f6c6bd.tar.gz
tests: work around coverity false-positives
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 6b37ac8103..b068b6e4ea 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -4969,15 +4969,16 @@ test_write_wired_aliases (void)
if (!g_strcmp0 (addrstr, ip[j]))
break;
}
- g_assert (j < num_addresses);
-
- g_assert_cmpint (nm_ip_address_get_prefix (addr), ==, 24);
- if (label[j])
- g_assert_cmpstr (g_variant_get_string (nm_ip_address_get_attribute (addr, "label"), NULL), ==, label[j]);
- else
- g_assert (nm_ip_address_get_attribute (addr, "label") == NULL);
-
- ip[j] = NULL;
+ if (j >= num_addresses)
+ g_assert_not_reached ();
+ else {
+ g_assert_cmpint (nm_ip_address_get_prefix (addr), ==, 24);
+ if (label[j])
+ g_assert_cmpstr (g_variant_get_string (nm_ip_address_get_attribute (addr, "label"), NULL), ==, label[j]);
+ else
+ g_assert (nm_ip_address_get_attribute (addr, "label") == NULL);
+ ip[j] = NULL;
+ }
}
for (i = 0; i < num_addresses; i++)