]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Check for negative indent in virBufferAdd
authorJohn Ferlan <jferlan@redhat.com>
Tue, 15 Jan 2013 18:12:59 +0000 (13:12 -0500)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 16 Jan 2013 09:52:39 +0000 (10:52 +0100)
Since virBufferGetIndent() will check and fail on buf->error, I
removed that check from virBufferAdd() and used the -1 return as the
way to exit.

src/util/virbuffer.c

index 969dcbf6b9408be31400b93396257084dfd8f6f1..693e4b2942ea6097fc77acda922481cbca799882 100644 (file)
@@ -153,10 +153,9 @@ virBufferAdd(virBufferPtr buf, const char *str, int len)
     if (!str || !buf || (len == 0 && buf->indent == 0))
         return;
 
-    if (buf->error)
-        return;
-
     indent = virBufferGetIndent(buf, true);
+    if (indent < 0)
+        return;
 
     if (len < 0)
         len = strlen(str);