From dff110d232ff6da536350a0d4412be7f85fbbff0 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 27 Mar 2018 18:14:12 +0200 Subject: [PATCH] tests: utils: Tolerate NULL actual data in virTestCompareToFile The function docs state that 'strcontent' may be NULL. This was added in 8b3a0b28ba2 but that commit neglected to fix rest of the function. Signed-off-by: Peter Krempa --- tests/testutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index 040ef1d2f7..4bd1b63755 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -800,8 +800,8 @@ virTestCompareToFile(const char *strcontent, if (filecontentLen > 0 && filecontent[filecontentLen - 1] == '\n' && - strcontent[strlen(strcontent) - 1] != '\n') { - if (virAsprintf(&fixedcontent, "%s\n", strcontent) < 0) + cmpcontent[strlen(cmpcontent) - 1] != '\n') { + if (virAsprintf(&fixedcontent, "%s\n", cmpcontent) < 0) goto failure; cmpcontent = fixedcontent; } -- 2.47.2