*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#if defined(__CYGWIN__) || defined(WIN32)
/* strip .exe suffix, regardless of case */
- if (strlen(nodir_name) > sizeof(EXE) &&
- pg_strcasecmp(nodir_name + strlen(nodir_name) - sizeof(EXE), EXE) == 0)
+ if (strlen(nodir_name) > sizeof(EXE) - 1 &&
+ pg_strcasecmp(nodir_name + strlen(nodir_name)-sizeof(EXE)-1, EXE) == 0)
{
char *progname;
fprintf(stderr, "%s: out of memory\n", nodir_name);
exit(1);
}
- progname[strlen(progname) - sizeof(EXE)] = '\0';
+ progname[strlen(progname) - sizeof(EXE) - 1] = '\0';
nodir_name = progname;
}
#endif