]> source.dussan.org Git - tigervnc.git/commitdiff
Handle line breaks in log messages
authorPierre Ossman <ossman@cendio.se>
Thu, 1 Nov 2018 15:04:30 +0000 (16:04 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 10 Dec 2018 19:19:43 +0000 (20:19 +0100)
common/rfb/Logger.cxx

index 3daf2486395bad11fe07dcf10fbdbf99b6a1f36e..ad10a4cf5bb620b5ff736ead73a582df7c1b58cd 100644 (file)
@@ -47,7 +47,16 @@ void Logger::write(int level, const char *logname, const char* format,
   char buf1[4096];
   vsnprintf(buf1, sizeof(buf1)-1, format, ap);
   buf1[sizeof(buf1)-1] = 0;
-  write(level, logname, buf1);
+  char *buf = buf1;
+  while (true) {
+    char *end = strchr(buf, '\n');
+    if (end)
+      *end = '\0';
+    write(level, logname, buf);
+    if (!end)
+      break;
+    buf = end + 1;
+  }
 }
 
 void