aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-04-28 05:07:34 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-04-28 05:07:34 +0000
commita90dc572ed4498e57381bdb7020ee453f4d20b57 (patch)
tree98231201565effaba8cac653eb005b6398a35e14 /src/backend/tcop/postgres.c
parent45cc0e9b27c12e0e7cfad23e9e3105159ed569b7 (diff)
downloadpostgresql-a90dc572ed4498e57381bdb7020ee453f4d20b57.tar.gz
postgresql-a90dc572ed4498e57381bdb7020ee453f4d20b57.zip
Setting statistic options from SET PG_OPTIONS caused a backend crash
because StatFp never got set in that case. Set it immediately before use to eliminate such problems.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index b84ae7b537e..bcb63bb2193 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.152 2000/04/23 00:13:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.153 2000/04/28 05:07:34 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -129,7 +129,7 @@ extern int NBuffers;
static bool EchoQuery = false; /* default don't echo */
time_t tim;
char pg_pathname[MAXPGPATH];
-FILE *StatFp;
+FILE *StatFp = NULL;
/* ----------------
* people who want to use EOF should #define DONTUSENEWLINE in
@@ -1105,7 +1105,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
* ----------------
*/
ShowStats = 1;
- StatFp = stderr;
break;
case 'T':
@@ -1127,7 +1126,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
* caution: -s can not be used together with -t.
* ----------------
*/
- StatFp = stderr;
switch (optarg[0])
{
case 'p':
@@ -1455,7 +1453,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.152 $ $Date: 2000/04/23 00:13:16 $\n");
+ puts("$Revision: 1.153 $ $Date: 2000/04/28 05:07:34 $\n");
}
/*
@@ -1695,6 +1693,12 @@ ShowUsage(void)
}
/*
+ * Set output destination if not otherwise set
+ */
+ if (StatFp == NULL)
+ StatFp = stderr;
+
+ /*
* the only stats we don't show here are for memory usage -- i can't
* figure out how to interpret the relevant fields in the rusage
* struct, and they change names across o/s platforms, anyway. if you