Skip to content
Snippets Groups Projects
Commit 62e7ad66 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

On Win32, return original patch if GetShortPathName() fails (no short

name, path does not exist), rather than returning nothing.

Backpatch to 8.1.X.
parent 8a30cc21
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.18 2006/03/05 15:58:50 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.19 2006/06/06 22:32:19 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -35,11 +35,6 @@ static char mypath[MAXPGPATH]; ...@@ -35,11 +35,6 @@ static char mypath[MAXPGPATH];
* on Windows. We need them to use filenames without spaces, for which a * on Windows. We need them to use filenames without spaces, for which a
* short filename is the safest equivalent, eg: * short filename is the safest equivalent, eg:
* C:/Progra~1/ * C:/Progra~1/
*
* This can fail in 2 ways - if the path doesn't exist, or short names are
* disabled. In the first case, don't return any path. In the second case,
* we leave the path in the long form. In this case, it does still seem to
* fix elements containing spaces which is all we actually need.
*/ */
static void static void
cleanup_path(char *path) cleanup_path(char *path)
...@@ -47,18 +42,12 @@ cleanup_path(char *path) ...@@ -47,18 +42,12 @@ cleanup_path(char *path)
#ifdef WIN32 #ifdef WIN32
char *ptr; char *ptr;
if (GetShortPathName(path, path, MAXPGPATH - 1) == 0) /*
{ * GetShortPathName() will fail if the path does not exist, or short names
/* * are disabled on this file system. In both cases, we just return the
* Ignore ERROR_INVALID_PARAMETER as it almost certainly means that * original path.
* short names are disabled */
*/ GetShortPathName(path, path, MAXPGPATH - 1);
if (GetLastError() != ERROR_INVALID_PARAMETER)
{
path[0] = '\0';
return;
}
}
/* Replace '\' with '/' */ /* Replace '\' with '/' */
for (ptr = path; *ptr; ptr++) for (ptr = path; *ptr; ptr++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment