summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-05-04 15:10:27 +0200
committerThomas Haller <thaller@redhat.com>2015-05-13 14:31:05 +0200
commitd8d0c481b8d1ad5e9599994c5e8f8fa83657ce5c (patch)
treedeb2bfb7be4d212625ed2dca23f09adf14cf5352
parentf167346534f98a803a6a7fd6e274cd1d07479f18 (diff)
downloadNetworkManager-d8d0c481b8d1ad5e9599994c5e8f8fa83657ce5c.tar.gz
test: fix wrong use of memcmp() in nmtst_platform_ip4_routes_equal()
And nmtst_platform_ip6_routes_equal(). As already indicated by the comment, using memcmp() doesn't really work here. It worked up to now, because the NMPlatformIP4Route structure has no padding at the end. If we would have a last 'guint8' member (as we will add later), initializing an arry of routes on the stack would not clear the bytes from the padding and the comparison using memcmp() would fail.
-rw-r--r--include/nm-test-utils.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h
index 04c5d5f1c5..94040c12c3 100644
--- a/include/nm-test-utils.h
+++ b/include/nm-test-utils.h
@@ -832,9 +832,6 @@ nmtst_platform_ip4_routes_equal (const NMPlatformIP4Route *a, const NMPlatformIP
nmtst_static_1024_02 (nm_platform_ip4_route_to_string (&b[i])));
g_assert_not_reached ();
}
-
- /* also check with memcmp, though this might fail for valid programs (due to field alignment) */
- g_assert_cmpint (memcmp (&a[i], &b[i], sizeof (a[i])), ==, 0);
}
}
@@ -867,9 +864,6 @@ nmtst_platform_ip6_routes_equal (const NMPlatformIP6Route *a, const NMPlatformIP
nmtst_static_1024_02 (nm_platform_ip6_route_to_string (&b[i])));
g_assert_not_reached ();
}
-
- /* also check with memcmp, though this might fail for valid programs (due to field alignment) */
- g_assert_cmpint (memcmp (&a[i], &b[i], sizeof (a[i])), ==, 0);
}
}