Skip to content

Commit 62e7ad6

Browse files
committed
On Win32, return original patch if GetShortPathName() fails (no short
name, path does not exist), rather than returning nothing. Backpatch to 8.1.X.
1 parent 8a30cc2 commit 62e7ad6

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/bin/pg_config/pg_config.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1919
*
20-
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.18 2006/03/05 15:58:50 momjian Exp $
20+
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.19 2006/06/06 22:32:19 momjian Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
@@ -35,30 +35,19 @@ static char mypath[MAXPGPATH];
3535
* on Windows. We need them to use filenames without spaces, for which a
3636
* short filename is the safest equivalent, eg:
3737
* C:/Progra~1/
38-
*
39-
* This can fail in 2 ways - if the path doesn't exist, or short names are
40-
* disabled. In the first case, don't return any path. In the second case,
41-
* we leave the path in the long form. In this case, it does still seem to
42-
* fix elements containing spaces which is all we actually need.
4338
*/
4439
static void
4540
cleanup_path(char *path)
4641
{
4742
#ifdef WIN32
4843
char *ptr;
4944

50-
if (GetShortPathName(path, path, MAXPGPATH - 1) == 0)
51-
{
52-
/*
53-
* Ignore ERROR_INVALID_PARAMETER as it almost certainly means that
54-
* short names are disabled
55-
*/
56-
if (GetLastError() != ERROR_INVALID_PARAMETER)
57-
{
58-
path[0] = '\0';
59-
return;
60-
}
61-
}
45+
/*
46+
* GetShortPathName() will fail if the path does not exist, or short names
47+
* are disabled on this file system. In both cases, we just return the
48+
* original path.
49+
*/
50+
GetShortPathName(path, path, MAXPGPATH - 1);
6251

6352
/* Replace '\' with '/' */
6453
for (ptr = path; *ptr; ptr++)

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