提交 dff110d2 编写于 作者: P Peter Krempa

tests: utils: Tolerate NULL actual data in virTestCompareToFile

The function docs state that 'strcontent' may be NULL. This was added in
8b3a0b28 but that commit neglected to fix rest of the function.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 452c2cc7
...@@ -800,8 +800,8 @@ virTestCompareToFile(const char *strcontent, ...@@ -800,8 +800,8 @@ virTestCompareToFile(const char *strcontent,
if (filecontentLen > 0 && if (filecontentLen > 0 &&
filecontent[filecontentLen - 1] == '\n' && filecontent[filecontentLen - 1] == '\n' &&
strcontent[strlen(strcontent) - 1] != '\n') { cmpcontent[strlen(cmpcontent) - 1] != '\n') {
if (virAsprintf(&fixedcontent, "%s\n", strcontent) < 0) if (virAsprintf(&fixedcontent, "%s\n", cmpcontent) < 0)
goto failure; goto failure;
cmpcontent = fixedcontent; cmpcontent = fixedcontent;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册