Commit ac1a3dcf authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Fix compilation problem with assert checking enabled for recent xlog

 location feature.
parent 0fe931a3
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.99 2002/08/04 06:53:10 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.100 2002/08/05 01:24:13 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -389,7 +389,8 @@ static ControlFileData *ControlFile = NULL; ...@@ -389,7 +389,8 @@ static ControlFileData *ControlFile = NULL;
/* File path names */ /* File path names */
static char XLogDir[MAXPGPATH] = ""; char *XLogDir = NULL;
static char ControlFilePath[MAXPGPATH]; static char ControlFilePath[MAXPGPATH];
/* /*
...@@ -2068,16 +2069,17 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI) ...@@ -2068,16 +2069,17 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
void void
SetXLogDir(char *path) SetXLogDir(char *path)
{ {
char *xsubdir = "/pg_xlog";
if (path != NULL) if (path != NULL)
{ {
if (strlen(path) >= MAXPGPATH) XLogDir = malloc(strlen(path)+1);
elog(FATAL, "XLOG path '%s' is too long"
"; maximum length is %d characters", path, MAXPGPATH-1);
strcpy(XLogDir, path); strcpy(XLogDir, path);
} }
else else
{ {
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir); XLogDir = malloc(strlen(DataDir)+strlen(xsubdir)+1);
snprintf(XLogDir, MAXPGPATH, "%s%s", DataDir, xsubdir);
} }
} }
...@@ -2085,7 +2087,7 @@ void ...@@ -2085,7 +2087,7 @@ void
XLOGPathInit(void) XLOGPathInit(void)
{ {
/* Init XLOG file paths */ /* Init XLOG file paths */
if (strlen(XLogDir) <= 0) if (XLogDir == NULL)
SetXLogDir(NULL); SetXLogDir(NULL);
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir); snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: xlog.h,v 1.32 2002/08/04 06:26:38 thomas Exp $ * $Id: xlog.h,v 1.33 2002/08/05 01:24:16 thomas Exp $
*/ */
#ifndef XLOG_H #ifndef XLOG_H
#define XLOG_H #define XLOG_H
...@@ -176,7 +176,7 @@ typedef struct XLogRecData ...@@ -176,7 +176,7 @@ typedef struct XLogRecData
} XLogRecData; } XLogRecData;
/* XLOG directory name */ /* XLOG directory name */
extern char XLogDir[]; extern char *XLogDir;
extern StartUpID ThisStartUpID; /* current SUI */ extern StartUpID ThisStartUpID; /* current SUI */
extern bool InRecovery; extern bool InRecovery;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment