diff options
author | Bruce Momjian <bruce@momjian.us> | 2004-07-11 02:59:42 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2004-07-11 02:59:42 +0000 |
commit | ff2fbacc427d203002f793822f1278698034e647 (patch) | |
tree | 03e3afbf21998f9ab061c3aaa35c0ab7626246e2 /src | |
parent | eee93173d4e6c0998feee6a534646f9e7d35c7d7 (diff) | |
download | postgresql-ff2fbacc427d203002f793822f1278698034e647.tar.gz postgresql-ff2fbacc427d203002f793822f1278698034e647.zip |
Fix trim_trailing_separator() to not trim c:\ nor \\network\ on Win32.
Diffstat (limited to 'src')
-rw-r--r-- | src/port/path.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/port/path.c b/src/port/path.c index 7621e39a0d6..8646eacc064 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.21 2004/07/10 22:58:42 tgl Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.22 2004/07/11 02:59:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -389,7 +389,26 @@ static void trim_trailing_separator(char *path) { char *p = path + strlen(path); - + +#ifdef WIN32 + /* Skip over network and drive specifiers for win32 */ + if (strlen(path) >= 2) + { + if (IS_DIR_SEP(path[0]) && IS_DIR_SEP(path[1])) + { + path += 2; + while (*path && !IS_DIR_SEP(*path)) + path++; + } + else if (isalpha(path[0]) && path[1] == ':') + { + path++; + if (IS_DIR_SEP(path[1])) + path++; + } + } +#endif + /* trim off trailing slashes */ if (p > path) for (p--; p > path && IS_DIR_SEP(*p); p--) |