tests: Use STRNEQ_NULLABLE

It's possible that the @outbuf and/or @errbuf could be NULL
and thus we need to use the right comparison macro.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
John Ferlan 2018-09-27 19:54:05 -04:00
parent 8f3c00c6e8
commit f0982d5faa

View File

@ -875,12 +875,12 @@ static int test21(const void *unused ATTRIBUTE_UNUSED)
if (virTestGetVerbose())
printf("STDOUT:%s\nSTDERR:%s\n", NULLSTR(outbuf), NULLSTR(errbuf));
if (STRNEQ(outbuf, outbufExpected)) {
if (STRNEQ_NULLABLE(outbuf, outbufExpected)) {
virTestDifference(stderr, outbufExpected, outbuf);
goto cleanup;
}
if (STRNEQ(errbuf, errbufExpected)) {
if (STRNEQ_NULLABLE(errbuf, errbufExpected)) {
virTestDifference(stderr, errbufExpected, errbuf);
goto cleanup;
}