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

[libvirt] [PATCH 11/20] qemumonitortestutils: Split lines on \n instead of \r\n



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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 941dfea..6dc430e 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -207,7 +207,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) {
@@ -215,7 +215,7 @@ qemuMonitorTestIO(virNetSocketPtr sock,
                 goto cleanup;
             }

-            t1 = t2 + 2;
+            t1 = t2 + 1;
         }
         used = t1 - test->incoming;
         memmove(test->incoming, t1, test->incomingLength - used);
-- 
1.8.3.2


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