mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
Fix build with older gcc
My commit af1c98e4 broke the build on RHEL-6: vircgrouptest.c: In function 'testCgroupGetPercpuStats': vircgrouptest.c:566: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs] The only thing that needs checking is that the array size is at least EXPECTED_NCPUS, to prevent access beyond the array. We can ensure the minimum size also by specifying the array size upfront.
This commit is contained in:
parent
3baeea6239
commit
d66e136bd5
@ -541,7 +541,7 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
|
|||||||
virTypedParameterPtr params = NULL;
|
virTypedParameterPtr params = NULL;
|
||||||
# define EXPECTED_NCPUS 160
|
# define EXPECTED_NCPUS 160
|
||||||
|
|
||||||
unsigned long long expected[] = {
|
unsigned long long expected[EXPECTED_NCPUS] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
7059492996, 0, 0, 0, 0, 0, 0, 0,
|
7059492996, 0, 0, 0, 0, 0, 0, 0,
|
||||||
4180532496, 0, 0, 0, 0, 0, 0, 0,
|
4180532496, 0, 0, 0, 0, 0, 0, 0,
|
||||||
@ -563,7 +563,6 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
|
|||||||
5683512916, 0, 0, 0, 0, 0, 0, 0,
|
5683512916, 0, 0, 0, 0, 0, 0, 0,
|
||||||
635751356, 0, 0, 0, 0, 0, 0, 0,
|
635751356, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(expected) == EXPECTED_NCPUS);
|
|
||||||
|
|
||||||
if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0)
|
if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user