Commit b2b585fb authored by Bruce Momjian's avatar Bruce Momjian

Clarify coding of .exe patch

parent a21c00d7
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.38 2004/10/27 17:17:09 momjian Exp $ * $PostgreSQL: pgsql/src/port/path.c,v 1.39 2004/11/01 04:25:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -195,8 +195,8 @@ get_progname(const char *argv0) ...@@ -195,8 +195,8 @@ get_progname(const char *argv0)
#if defined(__CYGWIN__) || defined(WIN32) #if defined(__CYGWIN__) || defined(WIN32)
/* strip .exe suffix, regardless of case */ /* strip .exe suffix, regardless of case */
if (strlen(nodir_name) > 4 && if (strlen(nodir_name) > sizeof(EXE) &&
stricmp(nodir_name + (strlen(nodir_name) - 4), EXE) == 0) pg_strcasecmp(nodir_name + strlen(nodir_name) - sizeof(EXE), EXE) == 0)
{ {
char *progname; char *progname;
...@@ -206,7 +206,7 @@ get_progname(const char *argv0) ...@@ -206,7 +206,7 @@ get_progname(const char *argv0)
fprintf(stderr, "%s: out of memory\n", nodir_name); fprintf(stderr, "%s: out of memory\n", nodir_name);
exit(1); exit(1);
} }
progname[strlen(progname) - 4] = '\0'; progname[strlen(progname) - sizeof(EXE)] = '\0';
nodir_name = progname; nodir_name = progname;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment