]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemucapsprobe: Don't put empty line at EOF
authorJiri Denemark <jdenemar@redhat.com>
Fri, 10 Jun 2016 15:15:25 +0000 (17:15 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 22 Jun 2016 08:45:28 +0000 (10:45 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tests/qemucapsprobemock.c

index 8ff4de970b0488dda3aac2e6c13d0e50afe00fbc..0c4c786b15c537def05718aa525c44cc32b48296 100644 (file)
@@ -62,6 +62,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
                              const char *line,
                              qemuMonitorMessagePtr msg)
 {
+    static bool first = true;
     virJSONValuePtr value = NULL;
     char *json = NULL;
     int ret;
@@ -76,6 +77,11 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
         char *p;
         bool skip = false;
 
+        if (first)
+            first = false;
+        else
+            putchar('\n');
+
         for (p = json; *p; p++) {
             if (skip && *p == '\n') {
                 continue;
@@ -84,7 +90,6 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
                 putchar(*p);
             }
         }
-        putchar('\n');
     }
 
     VIR_FREE(json);