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

[win-pv-devel] [PATCH] Make sure trailing whitespace is trimmed from log messages



Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xeniface/ioctls.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c
index ca2cf1c..e47ef6e 100644
--- a/src/xeniface/ioctls.c
+++ b/src/xeniface/ioctls.c
@@ -123,11 +123,14 @@ IoctlLog(
     if (!__IsValidStr(Buffer, InLen))
         goto fail2;
 
-       // remove newlines from end of buffer
-       for (ptr = Buffer + InLen - 1;
-                ptr != Buffer && *ptr != 0 && *ptr != '\n';
-                --ptr)
-                       *ptr = 0;
+       // remove whitespace from end of buffer
+       for (ptr = Buffer + InLen - 1; ptr != Buffer; --ptr) {
+        if (*ptr != '\n' && *ptr != '\r' && *ptr != '\0')
+            break;
+
+        *ptr = '\0';
+    }
+
     XenIfaceDebugPrint(INFO, "USER: %s\n", Buffer);
     return STATUS_SUCCESS;
 
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.