Обсуждение: yet another .exe path fix

Поиск
Список
Период
Сортировка

yet another .exe path fix

От
Andrew Dunstan
Дата:
The "adjustments" made to my previous patch to remove a trailing .exe
from get_progname()'s result broke it. The attached patch, which I have
tested, fixes the breakage.

cheers

andrew
Index: src/port/path.c
===================================================================
RCS file: /home/cvsmirror/pgsql/src/port/path.c,v
retrieving revision 1.42
diff -c -r1.42 path.c
*** src/port/path.c    6 Nov 2004 01:16:22 -0000    1.42
--- src/port/path.c    6 Nov 2004 03:34:56 -0000
***************
*** 285,291 ****
  #if defined(__CYGWIN__) || defined(WIN32)
      /* strip .exe suffix, regardless of case */
      if (strlen(nodir_name) > sizeof(EXE) - 1 &&
!         pg_strcasecmp(nodir_name + strlen(nodir_name)-sizeof(EXE)-1, EXE) == 0)
      {
          char *progname;

--- 285,291 ----
  #if defined(__CYGWIN__) || defined(WIN32)
      /* strip .exe suffix, regardless of case */
      if (strlen(nodir_name) > sizeof(EXE) - 1 &&
!         pg_strcasecmp(nodir_name + strlen(nodir_name)-(sizeof(EXE)-1), EXE) == 0)
      {
          char *progname;

***************
*** 295,301 ****
              fprintf(stderr, "%s: out of memory\n", nodir_name);
              exit(1);    /* This could exit the postmaster */
          }
!         progname[strlen(progname) - sizeof(EXE) - 1] = '\0';
          nodir_name = progname;
      }
  #endif
--- 295,301 ----
              fprintf(stderr, "%s: out of memory\n", nodir_name);
              exit(1);    /* This could exit the postmaster */
          }
!         progname[strlen(progname) - (sizeof(EXE) - 1)] = '\0';
          nodir_name = progname;
      }
  #endif

Re: yet another .exe path fix

От
Tom Lane
Дата:
Andrew Dunstan <andrew@dunslane.net> writes:
> The "adjustments" made to my previous patch to remove a trailing .exe
> from get_progname()'s result broke it. The attached patch, which I have
> tested, fixes the breakage.

Applied.

            regards, tom lane