If presented db path has a trailing slash, remove it to avoid generating
double slashes in generated filenames. This is not strictly necessary on standard Unixen, but I'm being a neatnik...
This commit is contained in:
parent
3382fbb60d
commit
653556cc26
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.84 2002/03/02 21:39:33 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.85 2002/03/04 04:45:27 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -121,9 +121,11 @@ void
|
|||||||
SetDataDir(const char *dir)
|
SetDataDir(const char *dir)
|
||||||
{
|
{
|
||||||
char *new;
|
char *new;
|
||||||
|
int newlen;
|
||||||
|
|
||||||
AssertArg(dir);
|
AssertArg(dir);
|
||||||
|
|
||||||
|
/* If presented path is relative, convert to absolute */
|
||||||
if (dir[0] != '/')
|
if (dir[0] != '/')
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
@ -164,6 +166,14 @@ SetDataDir(const char *dir)
|
|||||||
elog(FATAL, "out of memory");
|
elog(FATAL, "out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Strip any trailing slash. Not strictly necessary, but avoids
|
||||||
|
* generating funny-looking paths to individual files.
|
||||||
|
*/
|
||||||
|
newlen = strlen(new);
|
||||||
|
if (newlen > 1 && new[newlen-1] == '/')
|
||||||
|
new[newlen-1] = '\0';
|
||||||
|
|
||||||
if (DataDir)
|
if (DataDir)
|
||||||
free(DataDir);
|
free(DataDir);
|
||||||
DataDir = new;
|
DataDir = new;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user