]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
qemumonitortestutils: Split lines on \n instead of \r\n
authorPeter Krempa <pkrempa@redhat.com>
Thu, 25 Jul 2013 10:03:29 +0000 (12:03 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 31 Jul 2013 12:25:43 +0000 (14:25 +0200)
The normal monitor uses windows line endings, where the agent monitor
uses only newlines. Change this to tolerate both approaches and allow to
use the utilities for guest agent tests.

tests/qemumonitortestutils.c

index e02245de31dd4f5a064446b1a74a0773a27e1ccf..00ac0c6a71ede1e3398f35fd8893bf55723baa76 100644 (file)
@@ -201,7 +201,7 @@ qemuMonitorTestIO(virNetSocketPtr sock,
          * if so, handle that command
          */
         t1 = test->incoming;
-        while ((t2 = strstr(t1, "\r\n"))) {
+        while ((t2 = strstr(t1, "\n"))) {
             *t2 = '\0';
 
             if (qemuMonitorTestProcessCommand(test, t1) < 0) {
@@ -209,7 +209,7 @@ qemuMonitorTestIO(virNetSocketPtr sock,
                 goto cleanup;
             }
 
-            t1 = t2 + 2;
+            t1 = t2 + 1;
         }
         used = t1 - test->incoming;
         memmove(test->incoming, t1, test->incomingLength - used);