diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 52020544c3..9b8c2fd21c 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.67 2000/11/14 19:13:27 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.68 2000/11/25 04:38:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -657,7 +657,8 @@ write_syslog(int level, const char *line) seq++; /* divide into multiple syslog() calls if message is too long */ - if (len > PG_SYSLOG_LIMIT) + /* or if the message contains embedded NewLine(s) '\n' */ + if (len > PG_SYSLOG_LIMIT || strchr(line,'\n') != NULL ) { static char buf[PG_SYSLOG_LIMIT+1]; int chunk_nr = 0; @@ -667,9 +668,17 @@ write_syslog(int level, const char *line) { int l; int i; + /* if we start at a newline, move ahead one char */ + if (line[0] == '\n') + { + line++; + len--; + } strncpy(buf, line, PG_SYSLOG_LIMIT); buf[PG_SYSLOG_LIMIT] = '\0'; + if (strchr(buf,'\n') != NULL) + *strchr(buf,'\n') = '\0'; l = strlen(buf); #ifdef MULTIBYTE