Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b2b585f

Browse files
committed
Clarify coding of .exe patch
1 parent a21c00d commit b2b585f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/port/path.c

Lines changed: 4 additions & 4 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.38 2004/10/27 17:17:09 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.39 2004/11/01 04:25:18 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -195,8 +195,8 @@ get_progname(const char *argv0)
195195

196196
#if defined(__CYGWIN__) || defined(WIN32)
197197
/* strip .exe suffix, regardless of case */
198-
if (strlen(nodir_name) > 4 &&
199-
stricmp(nodir_name + (strlen(nodir_name) - 4), EXE) == 0)
198+
if (strlen(nodir_name) > sizeof(EXE) &&
199+
pg_strcasecmp(nodir_name + strlen(nodir_name) - sizeof(EXE), EXE) == 0)
200200
{
201201
char *progname;
202202

@@ -206,7 +206,7 @@ get_progname(const char *argv0)
206206
fprintf(stderr, "%s: out of memory\n", nodir_name);
207207
exit(1);
208208
}
209-
progname[strlen(progname) - 4] = '\0';
209+
progname[strlen(progname) - sizeof(EXE)] = '\0';
210210
nodir_name = progname;
211211
}
212212
#endif

0 commit comments

Comments
 (0)