Browse Source

Handle line breaks in log messages

tags/v1.9.90
Pierre Ossman 5 years ago
parent
commit
46c2c46273
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      common/rfb/Logger.cxx

+ 10
- 1
common/rfb/Logger.cxx View 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

Loading…
Cancel
Save