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

Adjust use of sizeof(EXE).

parent b2b585fb
Branches
Tags
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.39 2004/11/01 04:25:18 momjian Exp $ * $PostgreSQL: pgsql/src/port/path.c,v 1.40 2004/11/01 04:46:56 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) > sizeof(EXE) && if (strlen(nodir_name) > sizeof(EXE) - 1 &&
pg_strcasecmp(nodir_name + strlen(nodir_name) - sizeof(EXE), EXE) == 0) pg_strcasecmp(nodir_name + strlen(nodir_name)-sizeof(EXE)-1, 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) - sizeof(EXE)] = '\0'; progname[strlen(progname) - sizeof(EXE) - 1] = '\0';
nodir_name = progname; nodir_name = progname;
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment