Skip to content

Commit cd7d748

Browse files
committed
Repair multiple breakage in Windows-specific code for appending '.exe'.
1 parent 907855a commit cd7d748

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

contrib/pg_upgrade/exec.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,10 @@ validate_exec(const char *dir, const char *cmdName)
186186
snprintf(path, sizeof(path), "%s/%s", dir, cmdName);
187187

188188
#ifdef WIN32
189-
/* Win32 requires a .exe suffix for stat() */
190-
char path_exe[MAXPGPATH + sizeof(EXE_EXT) - 1];
191-
192-
if (strlen(path) >= strlen(EXE_EXT) &&
189+
/* Windows requires a .exe suffix for stat() */
190+
if (strlen(path) <= strlen(EXE_EXT) ||
193191
pg_strcasecmp(path + strlen(path) - strlen(EXE_EXT), EXE_EXT) != 0)
194-
{
195-
strcpy(path_exe, path);
196-
strcat(path_exe, EXE_EXT);
197-
path = path_exe;
198-
}
192+
strlcat(path, EXE_EXT, sizeof(path));
199193
#endif
200194

201195
/*

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