|
7 | 7 | * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.99 2002/08/04 06:53:10 thomas Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.100 2002/08/05 01:24:13 thomas Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -389,7 +389,8 @@ static ControlFileData *ControlFile = NULL;
|
389 | 389 |
|
390 | 390 |
|
391 | 391 | /* File path names */
|
392 |
| -static char XLogDir[MAXPGPATH] = ""; |
| 392 | +char *XLogDir = NULL; |
| 393 | + |
393 | 394 | static char ControlFilePath[MAXPGPATH];
|
394 | 395 |
|
395 | 396 | /*
|
@@ -2068,24 +2069,25 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
|
2068 | 2069 | void
|
2069 | 2070 | SetXLogDir(char *path)
|
2070 | 2071 | {
|
| 2072 | + char *xsubdir = "/pg_xlog"; |
| 2073 | + |
2071 | 2074 | if (path != NULL)
|
2072 | 2075 | {
|
2073 |
| - if (strlen(path) >= MAXPGPATH) |
2074 |
| - elog(FATAL, "XLOG path '%s' is too long" |
2075 |
| - "; maximum length is %d characters", path, MAXPGPATH-1); |
| 2076 | + XLogDir = malloc(strlen(path)+1); |
2076 | 2077 | strcpy(XLogDir, path);
|
2077 | 2078 | }
|
2078 | 2079 | else
|
2079 | 2080 | {
|
2080 |
| - snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir); |
| 2081 | + XLogDir = malloc(strlen(DataDir)+strlen(xsubdir)+1); |
| 2082 | + snprintf(XLogDir, MAXPGPATH, "%s%s", DataDir, xsubdir); |
2081 | 2083 | }
|
2082 | 2084 | }
|
2083 | 2085 |
|
2084 | 2086 | void
|
2085 | 2087 | XLOGPathInit(void)
|
2086 | 2088 | {
|
2087 | 2089 | /* Init XLOG file paths */
|
2088 |
| - if (strlen(XLogDir) <= 0) |
| 2090 | + if (XLogDir == NULL) |
2089 | 2091 | SetXLogDir(NULL);
|
2090 | 2092 | snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
|
2091 | 2093 | }
|
|
0 commit comments