Re: [PATCH 01/14] tests: utils: Tolerate NULL actual data in virTestCompareToFile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
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

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux