mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
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
|
||||
* $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)
|
||||
{
|
||||
char *new;
|
||||
int newlen;
|
||||
|
||||
AssertArg(dir);
|
||||
|
||||
/* If presented path is relative, convert to absolute */
|
||||
if (dir[0] != '/')
|
||||
{
|
||||
char *buf;
|
||||
@ -164,6 +166,14 @@ SetDataDir(const char *dir)
|
||||
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)
|
||||
free(DataDir);
|
||||
DataDir = new;
|
||||
|
Loading…
Reference in New Issue
Block a user