mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Fix trim_trailing_separator() to not trim c:\ nor \\network\ on Win32.
This commit is contained in:
parent
eee93173d4
commit
ff2fbacc42
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -390,6 +390,25 @@ trim_trailing_separator(char *path)
|
|||||||
{
|
{
|
||||||
char *p = path + strlen(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 */
|
/* trim off trailing slashes */
|
||||||
if (p > path)
|
if (p > path)
|
||||||
for (p--; p > path && IS_DIR_SEP(*p); p--)
|
for (p--; p > path && IS_DIR_SEP(*p); p--)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user