提交 d66e136b 编写于 作者: J Ján Tomko

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.
上级 3baeea62
......@@ -541,7 +541,7 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
virTypedParameterPtr params = NULL;
# define EXPECTED_NCPUS 160
unsigned long long expected[] = {
unsigned long long expected[EXPECTED_NCPUS] = {
0, 0, 0, 0, 0, 0, 0, 0,
7059492996, 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,
635751356, 0, 0, 0, 0, 0, 0, 0,
};
verify(ARRAY_CARDINALITY(expected) == EXPECTED_NCPUS);
if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0)
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册