* mu-log: fix logging oversized messages

This commit is contained in:
Dirk-Jan C. Binnema 2010-01-02 16:05:55 +02:00
parent ae5c92fc7a
commit 09b8437a8a
1 changed files with 4 additions and 1 deletions

View File

@ -168,7 +168,7 @@ log_write (const char* domain, GLogLevelFlags level,
ssize_t len;
/* log lines will be truncated at 255 chars */
char buf [255], timebuf [32];
char buf [512], timebuf [32];
/* get the time/date string */
now = time(NULL);
@ -177,6 +177,9 @@ log_write (const char* domain, GLogLevelFlags level,
/* now put it all together */
len = snprintf (buf, sizeof(buf), "%s [%s] %s\n", timebuf,
pfx(level), msg);
/* if the buffer is full, add a newline */
if (len == sizeof(buf))
buf[sizeof(buf)-2] = '\n';
len = write (MU_LOG->_fd, buf, len);
if (len < 0)