Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac1a3dc

Browse files
author
Thomas G. Lockhart
committed
Fix compilation problem with assert checking enabled for recent xlog
location feature.
1 parent 0fe931a commit ac1a3dc

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/backend/access/transam/xlog.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
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 $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -389,7 +389,8 @@ static ControlFileData *ControlFile = NULL;
389389

390390

391391
/* File path names */
392-
static char XLogDir[MAXPGPATH] = "";
392+
char *XLogDir = NULL;
393+
393394
static char ControlFilePath[MAXPGPATH];
394395

395396
/*
@@ -2068,24 +2069,25 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
20682069
void
20692070
SetXLogDir(char *path)
20702071
{
2072+
char *xsubdir = "/pg_xlog";
2073+
20712074
if (path != NULL)
20722075
{
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);
20762077
strcpy(XLogDir, path);
20772078
}
20782079
else
20792080
{
2080-
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
2081+
XLogDir = malloc(strlen(DataDir)+strlen(xsubdir)+1);
2082+
snprintf(XLogDir, MAXPGPATH, "%s%s", DataDir, xsubdir);
20812083
}
20822084
}
20832085

20842086
void
20852087
XLOGPathInit(void)
20862088
{
20872089
/* Init XLOG file paths */
2088-
if (strlen(XLogDir) <= 0)
2090+
if (XLogDir == NULL)
20892091
SetXLogDir(NULL);
20902092
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
20912093
}

src/include/access/xlog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: xlog.h,v 1.32 2002/08/04 06:26:38 thomas Exp $
9+
* $Id: xlog.h,v 1.33 2002/08/05 01:24:16 thomas Exp $
1010
*/
1111
#ifndef XLOG_H
1212
#define XLOG_H
@@ -176,7 +176,7 @@ typedef struct XLogRecData
176176
} XLogRecData;
177177

178178
/* XLOG directory name */
179-
extern char XLogDir[];
179+
extern char *XLogDir;
180180

181181
extern StartUpID ThisStartUpID; /* current SUI */
182182
extern bool InRecovery;

0 commit comments

Comments
 (0)