Skip to content

Commit ff2fbac

Browse files
committed
Fix trim_trailing_separator() to not trim c:\ nor \\network\ on Win32.
1 parent eee9317 commit ff2fbac

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/port/path.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.21 2004/07/10 22:58:42 tgl Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.22 2004/07/11 02:59:42 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -389,7 +389,26 @@ static void
389389
trim_trailing_separator(char *path)
390390
{
391391
char *p = path + strlen(path);
392-
392+
393+
#ifdef WIN32
394+
/* Skip over network and drive specifiers for win32 */
395+
if (strlen(path) >= 2)
396+
{
397+
if (IS_DIR_SEP(path[0]) && IS_DIR_SEP(path[1]))
398+
{
399+
path += 2;
400+
while (*path && !IS_DIR_SEP(*path))
401+
path++;
402+
}
403+
else if (isalpha(path[0]) && path[1] == ':')
404+
{
405+
path++;
406+
if (IS_DIR_SEP(path[1]))
407+
path++;
408+
}
409+
}
410+
#endif
411+
393412
/* trim off trailing slashes */
394413
if (p > path)
395414
for (p--; p > path && IS_DIR_SEP(*p); p--)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy