mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
The problem is that read_pg_options needs DataDir to read its file but
DataDir is set after read_pg_options if postgres is called interactively. If postgres is forked by postgres DataDir is read from the PGDATA enviromnent variable set by the postmaster and this explains while the bug disappears. I have written this patch but I don't like it. Any better idea? Massimo Dal Zotto
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.93 1998/10/13 20:05:44 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.94 1998/10/16 06:05:13 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -1053,6 +1053,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D': /* PGDATA directory */
|
case 'D': /* PGDATA directory */
|
||||||
|
if (!DataDir) {
|
||||||
|
DataDir = optarg;
|
||||||
|
/* must be done after DataDir is defined */
|
||||||
|
read_pg_options(0);
|
||||||
|
}
|
||||||
DataDir = optarg;
|
DataDir = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1514,7 +1519,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.93 $ $Date: 1998/10/13 20:05:44 $\n");
|
puts("$Revision: 1.94 $ $Date: 1998/10/16 06:05:13 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.25 1998/08/25 21:24:10 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.26 1998/10/16 06:05:16 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Globals used all over the place should be declared here and not
|
* Globals used all over the place should be declared here and not
|
||||||
@ -46,7 +46,7 @@ int MyProcPid;
|
|||||||
struct Port *MyProcPort;
|
struct Port *MyProcPort;
|
||||||
long MyCancelKey;
|
long MyCancelKey;
|
||||||
|
|
||||||
char *DataDir;
|
char *DataDir = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The PGDATA directory user says to use, or defaults to via environment
|
* The PGDATA directory user says to use, or defaults to via environment
|
||||||
|
@ -339,6 +339,11 @@ read_pg_options(SIGNAL_ARGS)
|
|||||||
char *s,
|
char *s,
|
||||||
*p;
|
*p;
|
||||||
|
|
||||||
|
if (!DataDir) {
|
||||||
|
fprintf(stderr, "read_pg_options: DataDir not defined\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(buffer, "%s/%s", DataDir, "pg_options");
|
sprintf(buffer, "%s/%s", DataDir, "pg_options");
|
||||||
if ((fd = open(buffer, O_RDONLY)) < 0)
|
if ((fd = open(buffer, O_RDONLY)) < 0)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user