diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2007-07-19 19:14:25 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2007-07-19 19:14:25 +0000 |
commit | 5a7d6179f6ffe6c6e99a8e7379131c4748b8ae4d (patch) | |
tree | a4fd588d5521e0ffb3dabbe612a033745801e8d2 /src/backend/postmaster/syslogger.c | |
parent | 6869810637f0f6204e2037c227dafad33a8ce3c1 (diff) | |
download | postgresql-5a7d6179f6ffe6c6e99a8e7379131c4748b8ae4d.tar.gz postgresql-5a7d6179f6ffe6c6e99a8e7379131c4748b8ae4d.zip |
Only use the pipe chunking protocol if we know the syslogger should
be catching stderr output, and we are not ourselves the
syslogger. Otherwise, go directly to stderr.
Bug noticed by Tom Lane.
Backpatch as far as 8.0.
Diffstat (limited to 'src/backend/postmaster/syslogger.c')
-rw-r--r-- | src/backend/postmaster/syslogger.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index 96c4cf130d5..110bec9f78e 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -18,7 +18,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.29.2.1 2007/06/14 01:49:39 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.29.2.2 2007/07/19 19:14:25 adunstan Exp $ * *------------------------------------------------------------------------- */ @@ -79,11 +79,12 @@ bool Log_truncate_on_rotation = false; */ bool am_syslogger = false; +extern bool redirection_done; + /* * Private state */ static pg_time_t next_rotation_time; -static bool redirection_done = false; static bool pipe_eof_seen = false; static FILE *syslogFile = NULL; static char *last_file_name = NULL; @@ -583,14 +584,12 @@ syslogger_forkexec(void) snprintf(numbuf[bufc++], 32, "%d", fileno(syslogFile)); else strcpy(numbuf[bufc++], "-1"); - snprintf(numbuf[bufc++], 32, "%d", (int) redirection_done); #else /* WIN32 */ if (syslogFile != NULL) snprintf(numbuf[bufc++], 32, "%ld", _get_osfhandle(_fileno(syslogFile))); else strcpy(numbuf[bufc++], "0"); - snprintf(numbuf[bufc++], 32, "%d", (int) redirection_done); #endif /* WIN32 */ /* Add to the arg list */ @@ -624,7 +623,6 @@ syslogger_parseArgs(int argc, char *argv[]) syslogFile = fdopen(fd, "a"); setvbuf(syslogFile, NULL, LBF_MODE, 0); } - redirection_done = (bool) atoi(*argv++); #else /* WIN32 */ fd = atoi(*argv++); if (fd != 0) @@ -636,7 +634,6 @@ syslogger_parseArgs(int argc, char *argv[]) setvbuf(syslogFile, NULL, LBF_MODE, 0); } } - redirection_done = (bool) atoi(*argv++); #endif /* WIN32 */ } #endif /* EXEC_BACKEND */ |