diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2000-06-22 22:31:24 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2000-06-22 22:31:24 +0000 |
commit | c4465095659bb089e08f8c94ce045ba3572a194f (patch) | |
tree | 14b2fcbc9cf78738a235e4b9c7c38c1dce7656f3 /src/backend/tcop/postgres.c | |
parent | bc06269495c42ab7eb15a905d84374f78829a065 (diff) | |
download | postgresql-c4465095659bb089e08f8c94ce045ba3572a194f.tar.gz postgresql-c4465095659bb089e08f8c94ce045ba3572a194f.zip |
Second pass over run-time configuration system. Adjust priorities on some
option settings. Sort out SIGHUP vs BACKEND -- there is no total ordering
here, so make explicit checks. Add comments explaining all of this.
Removed permissions check on SHOW command.
Add examine_subclass to the game, rename to SQL_inheritance to fit the
official data model better. Adjust documentation.
Standalone backend needs to reset all options before it starts. To
facilitate that, have IsUnderPostmaster be set by the postmaster itself,
don't wait for the magic -p switch.
Also make sure that all environment variables and argv's survive
init_ps_display(). Use strdup where necessary.
Have initdb make configuration files (postgresql.conf, pg_hba.conf) mode
0600 -- having configuration files is no fun if you can't edit them.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 631f482e81a..9209b6509f2 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.160 2000/06/15 04:10:19 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.161 2000/06/22 22:31:20 petere Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -824,13 +824,15 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) /* * Set default values for command-line options. */ - IsUnderPostmaster = false; Noversion = false; EchoQuery = false; -#ifdef LOCK_MGR_DEBUG - LockDebug = 0; -#endif - DataDir = getenv("PGDATA"); + + if (!IsUnderPostmaster) + { + ResetAllOptions(); + if (getenv("PGDATA")) + DataDir = strdup(getenv("PGDATA")); + } StatFp = stderr; SetProcessingMode(InitProcessing); @@ -891,7 +893,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) case 'D': /* PGDATA directory */ if (secure) - DataDir = optarg; + { + if (DataDir) + free(DataDir); + DataDir = strdup(optarg); + } break; case 'd': /* debug level */ @@ -1022,8 +1028,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) */ if (secure) { - IsUnderPostmaster = true; - DBName = optarg; + DBName = strdup(optarg); secure = false; /* subsequent switches are NOT * secure */ } @@ -1171,12 +1176,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) } /* - * Make a copy of DataDir because the arguments and environment - * might be moved around later on. - */ - DataDir = strdup(DataDir); - - /* * 1. Set BlockSig and UnBlockSig masks. 2. Set up signal handlers. 3. * Allow only SIGUSR1 signal (we never block it) during * initialization. @@ -1330,7 +1329,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) /* - * Set process params for ps + * Set process parameters for ps + * + * WARNING: On some platforms the environment will be moved + * around to make room for the ps display string. So any + * references to optarg or getenv() from above will be invalid + * after this call. Better use strdup or something similar. */ init_ps_display(real_argc, real_argv, userName, DBName, remote_host); set_ps_display("startup"); @@ -1382,7 +1386,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.160 $ $Date: 2000/06/15 04:10:19 $\n"); + puts("$Revision: 1.161 $ $Date: 2000/06/22 22:31:20 $\n"); } /* |