提交 5f244e31 编写于 作者: J Jiri Denemark

vircapstest: Avoid (im)possible strcmp call with NULL argument

Some compilers may get confused and decide we are calling strcmp with
NULL argument from test_virCapsDomainDataLookupLXC. Although this does
not really happen since the call is guarded with
(data->machinetype != expect_machinetype), using STRNEQ_NULLABLE is
easier to understand, less fragile, and doing so makes sure strcmp is
never called with NULL argument.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 f9d8b027
......@@ -188,11 +188,10 @@ doCapsCompare(virCapsPtr caps,
goto error;
}
if (data->machinetype != expect_machinetype &&
STRNEQ(data->machinetype, expect_machinetype)) {
if (STRNEQ_NULLABLE(data->machinetype, expect_machinetype)) {
fprintf(stderr, "data->machinetype=%s doesn't match "
"expect_machinetype=%s\n",
data->machinetype, expect_machinetype);
NULLSTR(data->machinetype), NULLSTR(expect_machinetype));
goto error;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册