On Thu, Mar 29, 2018 at 01:50:58PM +0200, Peter Krempa wrote:
The function docs state that 'strcontent' may be NULL, but
code added in
3506f1ecfde did not use the 'cmpcontent' variable which was fixed and
dereferenced it.
easier to follow as:
3506f1ecfde dereferenced it instead of using the fixed 'cmpcontent'
variable.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
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)
ACK if you check if strlen(cmpcontent) > 0 as well.
Jano