mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Remove SEP_CHAR, replace with / or '/' as appropriate.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.45 2001/03/22 06:16:19 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.46 2001/05/30 14:15:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -52,20 +52,19 @@ ExpandDatabasePath(const char *dbpath)
|
||||
return NULL; /* ain't gonna fit nohow */
|
||||
|
||||
/* leading path delimiter? then already absolute path */
|
||||
if (*dbpath == SEP_CHAR)
|
||||
if (*dbpath == '/')
|
||||
{
|
||||
#ifdef ALLOW_ABSOLUTE_DBPATHS
|
||||
cp = strrchr(dbpath, SEP_CHAR);
|
||||
cp = strrchr(dbpath, '/');
|
||||
len = cp - dbpath;
|
||||
strncpy(buf, dbpath, len);
|
||||
snprintf(&buf[len], MAXPGPATH - len, "%cbase%c%s",
|
||||
SEP_CHAR, SEP_CHAR, (cp + 1));
|
||||
snprintf(&buf[len], MAXPGPATH - len, "/base/%s", (cp + 1));
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
/* path delimiter somewhere? then has leading environment variable */
|
||||
else if ((cp = strchr(dbpath, SEP_CHAR)) != NULL)
|
||||
else if ((cp = strchr(dbpath, '/')) != NULL)
|
||||
{
|
||||
const char *envvar;
|
||||
|
||||
@@ -76,14 +75,12 @@ ExpandDatabasePath(const char *dbpath)
|
||||
if (envvar == NULL)
|
||||
return NULL;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s%cbase%c%s",
|
||||
envvar, SEP_CHAR, SEP_CHAR, (cp + 1));
|
||||
snprintf(buf, sizeof(buf), "%s/base/%s", envvar, (cp + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no path delimiter? then add the default path prefix */
|
||||
snprintf(buf, sizeof(buf), "%s%cbase%c%s",
|
||||
DataDir, SEP_CHAR, SEP_CHAR, dbpath);
|
||||
snprintf(buf, sizeof(buf), "%s/base/%s", DataDir, dbpath);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user