yet another .exe path fix - Mailing list pgsql-patches

From Andrew Dunstan
Subject yet another .exe path fix
Date
Msg-id 418C4774.3070201@dunslane.net
Whole thread Raw
Responses Re: yet another .exe path fix  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Markus Bertheau
Date:
Subject: Re: contrib/xml2: add function xml_encode_special_chars
Next
From: Tom Lane
Date:
Subject: Re: yet another .exe path fix