Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 17befd6

Browse files
author
Bryan Henderson
committed
Use new utils/version.c instead of backend/utils/init/magic.c.
1 parent bbe8908 commit 17befd6

File tree

7 files changed

+370
-354
lines changed

7 files changed

+370
-354
lines changed

src/backend/Makefile

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
#
3636
# IDENTIFICATION
37-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.14 1996/11/03 09:05:30 bryanh Exp $
37+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.15 1996/11/12 06:46:04 bryanh Exp $
3838
#
3939
#-------------------------------------------------------------------------
4040

@@ -131,15 +131,16 @@ OBJS = access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o \
131131
lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o nodes/SUBSYS.o \
132132
optimizer/SUBSYS.o parser/SUBSYS.o port/SUBSYS.o \
133133
postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o \
134-
storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o
134+
storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o \
135+
../utils/version.o
135136

136137
ifdef TIOGA
137138
OBJS += tioga/SUBSYS.o
138139
endif
139140

140141
all: postgres global1.bki.source local1_template1.bki.source
141142

142-
postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
143+
postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
143144
$(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
144145

145146
postgres_group1:
@@ -167,6 +168,7 @@ postgres_group4:
167168
ifdef TIOGA
168169
$(MAKE) -C tioga all
169170
endif
171+
$(MAKE) -C ../utils version.o
170172

171173
global1.bki.source local1_template1.bki.source:
172174
$(MAKE) -C catalog $@

src/backend/postmaster/postmaster.c

+17-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.23 1996/11/10 03:01:41 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.24 1996/11/12 06:46:36 bryanh Exp $
1414
*
1515
* NOTES
1616
*
@@ -75,6 +75,7 @@
7575
#include "libpq/auth.h"
7676
#include "libpq/pqcomm.h"
7777
#include "miscadmin.h"
78+
#include "version.h"
7879
#include "lib/dllist.h"
7980
#include "nodes/nodes.h"
8081
#include "utils/mcxt.h"
@@ -1186,18 +1187,27 @@ checkDataDir(void)
11861187
SEP_CHAR);
11871188
if ((fp=fopen(path, "r")) == NULL) {
11881189
fprintf(stderr, "%s does not find the database. Expected to find it "
1189-
"in the PGDATA directory \"%s\", but unable to open directory "
1190+
"in the PGDATA directory \"%s\", but unable to open file "
11901191
"with pathname \"%s\".\n",
11911192
progname, DataDir, path);
11921193
exit(2);
11931194
}
11941195
fclose(fp);
11951196

1196-
#ifndef WIN32
1197-
if (!ValidPgVersion(DataDir)) {
1198-
fprintf(stderr, "%s: data base in \"%s\" is of a different version.\n",
1199-
progname, DataDir);
1200-
exit(2);
1197+
#ifndef WIN32
1198+
{
1199+
char *reason; /* reason ValidatePgVersion failed. NULL if didn't */
1200+
ValidatePgVersion(DataDir, &reason);
1201+
if (reason) {
1202+
fprintf(stderr,
1203+
"Database system in directory %s "
1204+
"is not compatible with this version of "
1205+
"Postgres, or we are unable to read the PG_VERSION file. "
1206+
"Explanation from ValidatePgVersion: %s\n",
1207+
DataDir, reason);
1208+
free(reason);
1209+
exit(2);
1210+
}
12011211
}
12021212
#endif /* WIN32 */
12031213
}

src/backend/utils/init/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for utils/init
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.2 1996/11/09 06:23:41 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.3 1996/11/12 06:46:40 bryanh Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -20,7 +20,7 @@ CFLAGS += $(INCLUDE_OPT)
2020
CFLAGS += -DPOSTGRESDIR='"$(POSTGRESDIR)"' -DPGDATADIR='"$(DATADIR)"' \
2121
-DPOSTPORT='"$(POSTPORT)"'
2222

23-
OBJS = enbl.o findbe.o globals.o magic.o miscinit.o postinit.o
23+
OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o
2424

2525
all: SUBSYS.o
2626

0 commit comments

Comments
 (0)