mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
tests: utils: Tolerate NULL actual data in virTestCompareToFile
The function docs state that 'strcontent' may be NULL. This was added in
8b3a0b28ba
but that commit neglected to fix rest of the function.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
452c2cc7e7
commit
dff110d232
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user