Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fa2742

Browse files
committed
The problem is that read_pg_options needs DataDir to read its file but
DataDir is set after read_pg_options if postgres is calledinteractively. If postgres is forked by postgres DataDir is read fromthe PGDATA enviromnent variable set by the postmaster and this explainswhile the bug disappears. I have written this patch but I don't likeit. Any better idea?Massimo Dal Zotto
1 parent9f69aa0 commit8fa2742

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.93 1998/10/13 20:05:44 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.94 1998/10/16 06:05:13 momjian Exp $
1111
*
1212
* NOTES
1313
* 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[])
10531053
break;
10541054

10551055
case'D':/* PGDATA directory */
1056+
if (!DataDir) {
1057+
DataDir=optarg;
1058+
/* must be done after DataDir is defined */
1059+
read_pg_options(0);
1060+
}
10561061
DataDir=optarg;
10571062
break;
10581063

@@ -1514,7 +1519,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
15141519
if (!IsUnderPostmaster)
15151520
{
15161521
puts("\nPOSTGRES backend interactive interface ");
1517-
puts("$Revision: 1.93 $ $Date: 1998/10/13 20:05:44 $\n");
1522+
puts("$Revision: 1.94 $ $Date: 1998/10/16 06:05:13 $\n");
15181523
}
15191524

15201525
/* ----------------

‎src/backend/utils/init/globals.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.25 1998/08/25 21:24:10 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.26 1998/10/16 06:05:16 momjian Exp $
1111
*
1212
* NOTES
1313
* Globals used all over the place should be declared here and not
@@ -46,7 +46,7 @@ intMyProcPid;
4646
structPort*MyProcPort;
4747
longMyCancelKey;
4848

49-
char*DataDir;
49+
char*DataDir=NULL;
5050

5151
/*
5252
* The PGDATA directory user says to use, or defaults to via environment

‎src/backend/utils/misc/trace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ read_pg_options(SIGNAL_ARGS)
339339
char*s,
340340
*p;
341341

342+
if (!DataDir) {
343+
fprintf(stderr,"read_pg_options: DataDir not defined\n");
344+
return;
345+
}
346+
342347
sprintf(buffer,"%s/%s",DataDir,"pg_options");
343348
if ((fd=open(buffer,O_RDONLY))<0)
344349
return;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp