]> xenbits.xensource.com Git - people/pauldu/xeniface.git/commitdiff
Make sure trailing whitespace is trimmed from log messages
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 27 Jul 2016 11:54:06 +0000 (12:54 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 27 Jul 2016 11:54:58 +0000 (12:54 +0100)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xeniface/ioctls.c

index ca2cf1cc2970b4d378b0daa71b0cf565d6c74bdf..e47ef6eb72f4fe27c0e4c0d1800f8cdb05ec2a62 100644 (file)
@@ -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;