summaryrefslogtreecommitdiff
path: root/src/port/path.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-10-27 17:17:09 +0000
committerBruce Momjian <bruce@momjian.us>2004-10-27 17:17:09 +0000
commit3fe704209adddf2835bb3e694267acddfc49bc9e (patch)
tree9a5637b732eac5efd76399ea40cd21bb3b3956f7 /src/port/path.c
parent118bd9180958bcb62de255a6d1490d129d7e92d8 (diff)
downloadpostgresql-3fe704209adddf2835bb3e694267acddfc49bc9e.tar.gz
Canonicalize Win32 path coming in from pg_ctl -D, idea from Magnus.
Diffstat (limited to 'src/port/path.c')
-rw-r--r--src/port/path.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/port/path.c b/src/port/path.c
index 65fc36e674..896a0378b2 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.37 2004/10/24 22:08:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.38 2004/10/27 17:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -115,7 +115,12 @@ make_native_path(char *filename)
/*
- * Make all paths look like Unix
+ * Clean up path by:
+ * o make Win32 path use Unix slashes
+ * o remove trailling quote on Win32
+ * o remove trailling slash
+ * o remove trailing '.'
+ * o process trailing '..' ourselves
*/
void
canonicalize_path(char *path)
@@ -145,13 +150,13 @@ canonicalize_path(char *path)
/*
* Removing the trailing slash on a path means we never get ugly
- * double slashes. Also, Win32 can't stat() a directory with a
- * trailing slash. Don't remove a leading slash, though.
+ * double trailing slashes. Also, Win32 can't stat() a directory
+ * with a trailing slash. Don't remove a leading slash, though.
*/
trim_trailing_separator(path);
/*
- * Remove any trailing uses of "." or "..", too.
+ * Remove any trailing uses of "." and process ".." ourselves
*/
for (;;)
{
@@ -165,7 +170,7 @@ canonicalize_path(char *path)
else if (len >= 3 && strcmp(path + len - 3, "/..") == 0)
{
trim_directory(path);
- trim_directory(path);
+ trim_directory(path); /* remove directory above */
trim_trailing_separator(path);
}
else