Skip to content

Commit 91ba4cc

Browse files
committed
> > Looking some more, I found some other places that need a space (I
> > suspect...), so here is an updated patch. > > This seems like the wrong way to go about it, because anytime anyone > changes any elog output anywhere, we'll risk another failure. If > syslog can't cope with empty lines, I think the right fix is for the > output-to-syslog routine to change the data just before sending --- > then there is only one place to fix. See the syslog output routine in > src/backend/utils/error/elog.c. Makes sense. Here's a new patch, now the output even looks better: Larry Rosenman
1 parent d5d23dd commit 91ba4cc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/backend/utils/error/elog.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.67 2000/11/14 19:13:27 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.68 2000/11/25 04:38:00 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -657,7 +657,8 @@ write_syslog(int level, const char *line)
657657
seq++;
658658

659659
/* divide into multiple syslog() calls if message is too long */
660-
if (len > PG_SYSLOG_LIMIT)
660+
/* or if the message contains embedded NewLine(s) '\n' */
661+
if (len > PG_SYSLOG_LIMIT || strchr(line,'\n') != NULL )
661662
{
662663
static char buf[PG_SYSLOG_LIMIT+1];
663664
int chunk_nr = 0;
@@ -667,9 +668,17 @@ write_syslog(int level, const char *line)
667668
{
668669
int l;
669670
int i;
671+
/* if we start at a newline, move ahead one char */
672+
if (line[0] == '\n')
673+
{
674+
line++;
675+
len--;
676+
}
670677

671678
strncpy(buf, line, PG_SYSLOG_LIMIT);
672679
buf[PG_SYSLOG_LIMIT] = '\0';
680+
if (strchr(buf,'\n') != NULL)
681+
*strchr(buf,'\n') = '\0';
673682

674683
l = strlen(buf);
675684
#ifdef MULTIBYTE

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy