mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
> > 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
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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++;
|
seq++;
|
||||||
|
|
||||||
/* divide into multiple syslog() calls if message is too long */
|
/* 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];
|
static char buf[PG_SYSLOG_LIMIT+1];
|
||||||
int chunk_nr = 0;
|
int chunk_nr = 0;
|
||||||
@ -667,9 +668,17 @@ write_syslog(int level, const char *line)
|
|||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
int i;
|
int i;
|
||||||
|
/* if we start at a newline, move ahead one char */
|
||||||
|
if (line[0] == '\n')
|
||||||
|
{
|
||||||
|
line++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(buf, line, PG_SYSLOG_LIMIT);
|
strncpy(buf, line, PG_SYSLOG_LIMIT);
|
||||||
buf[PG_SYSLOG_LIMIT] = '\0';
|
buf[PG_SYSLOG_LIMIT] = '\0';
|
||||||
|
if (strchr(buf,'\n') != NULL)
|
||||||
|
*strchr(buf,'\n') = '\0';
|
||||||
|
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
#ifdef MULTIBYTE
|
#ifdef MULTIBYTE
|
||||||
|
Reference in New Issue
Block a user