aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-01-22 20:57:39 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-01-22 20:57:39 +0000
commitbfa5304262483fbdcd31ea5883fa73031a183091 (patch)
treec50ac7b22b8e7d8a0372b26d433e2f82348e1325 /src
parent58ae3cf12cbc46211307b6cdcb7304429eca37bd (diff)
downloadpostgresql-bfa5304262483fbdcd31ea5883fa73031a183091.tar.gz
postgresql-bfa5304262483fbdcd31ea5883fa73031a183091.zip
Remove ExpandDatabasePath(), which is unused and must have been so since
7.1, because the path interpretation it embodies has been wrong since 7.1.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/misc/database.c87
-rw-r--r--src/include/miscadmin.h3
2 files changed, 2 insertions, 88 deletions
diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c
index 1d806a2732b..37844a03a94 100644
--- a/src/backend/utils/misc/database.c
+++ b/src/backend/utils/misc/database.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/database.c,v 1.59 2003/11/29 19:52:03 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/database.c,v 1.60 2004/01/22 20:57:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,91 +28,6 @@
static bool PhonyHeapTupleSatisfiesNow(HeapTupleHeader tuple);
-/*
- * ExpandDatabasePath resolves a proposed database path (obtained from
- * pg_database.datpath) to a full absolute path for further consumption.
- * NULL means an error, which the caller should process. One reason for
- * such an error would be an absolute alternative path when no absolute
- * paths are allowed.
- */
-
-char *
-ExpandDatabasePath(const char *dbpath)
-{
- char buf[MAXPGPATH];
- const char *cp;
- int len;
-
- AssertArg(dbpath);
- Assert(DataDir);
-
- if (strlen(dbpath) >= MAXPGPATH)
- return NULL; /* ain't gonna fit nohow */
-
- /* leading path delimiter? then already absolute path */
- if (is_absolute_path(dbpath))
- {
-#ifdef ALLOW_ABSOLUTE_DBPATHS
- cp = last_path_separator(dbpath);
- len = cp - dbpath;
- strncpy(buf, dbpath, len);
- snprintf(&buf[len], MAXPGPATH - len, "/base/%s", (cp + 1));
-#else
- return NULL;
-#endif
- }
- /* path delimiter somewhere? then has leading environment variable */
- else if ((cp = first_path_separator(dbpath)) != NULL)
- {
- const char *envvar;
-
- len = cp - dbpath;
- strncpy(buf, dbpath, len);
- buf[len] = '\0';
- envvar = getenv(buf);
- if (envvar == NULL)
- return NULL;
-
- 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/base/%s", DataDir, dbpath);
- }
-
- /*
- * check for illegal characters in dbpath these should really throw an
- * error, shouldn't they? or else all callers need to test for NULL
- */
- for (cp = buf; *cp; cp++)
- {
- /*
- * The following characters will not be allowed anywhere in the
- * database path. (Do not include the slash or '.' here.)
- */
- char illegal_dbpath_chars[] =
- "\001\002\003\004\005\006\007\010"
- "\011\012\013\014\015\016\017\020"
- "\021\022\023\024\025\026\027\030"
- "\031\032\033\034\035\036\037"
- "'`";
-
- const char *cx;
-
- for (cx = illegal_dbpath_chars; *cx; cx++)
- if (*cp == *cx)
- return NULL;
- /* don't allow access to parent dirs */
- if (strncmp(cp, "/../", 4) == 0)
- return NULL;
- }
-
- return pstrdup(buf);
-} /* ExpandDatabasePath() */
-
-
-
/* --------------------------------
* GetRawDatabaseInfo() -- Find the OID and path of the database.
*
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 22b42042ad7..67be1137fc9 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.144 2004/01/09 23:29:31 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.145 2004/01/22 20:57:39 tgl Exp $
*
* NOTES
* some of the information in this file should be moved to
@@ -231,7 +231,6 @@ extern char *DatabasePath;
/* in utils/misc/database.c */
extern void GetRawDatabaseInfo(const char *name, Oid *db_id, char *path);
-extern char *ExpandDatabasePath(const char *path);
/* now in utils/init/miscinit.c */
extern void SetDatabasePath(const char *path);