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
*
*
* 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
* this is the "main" module of the postgres backend and
break;
case 'D': /* PGDATA directory */
+ if (!DataDir) {
+ DataDir = optarg;
+ /* must be done after DataDir is defined */
+ read_pg_options(0);
+ }
DataDir = optarg;
break;
if (!IsUnderPostmaster)
{
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");
}
/* ----------------
*
*
* 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
* Globals used all over the place should be declared here and not
struct Port *MyProcPort;
long MyCancelKey;
-char *DataDir;
+char *DataDir = NULL;
/*
* The PGDATA directory user says to use, or defaults to via environment
char *s,
*p;
+ if (!DataDir) {
+ fprintf(stderr, "read_pg_options: DataDir not defined\n");
+ return;
+ }
+
sprintf(buffer, "%s/%s", DataDir, "pg_options");
if ((fd = open(buffer, O_RDONLY)) < 0)
return;