]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2006-11-08 Vladimir Prus <vladimir@codesourcery.com>
authorVladimir Prus <vladimir@codesourcery.com>
Wed, 8 Nov 2006 17:45:23 +0000 (17:45 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Wed, 8 Nov 2006 17:45:23 +0000 (17:45 +0000)
        * pex-win32.c (no_suffixes): Remove.
        (std_suffixes): Add "" as first element.
        (find_executable): Remove detection of already-present
        extension. Try all suffixes in std_suffixes.

ChangeLog.csl
libiberty/pex-win32.c

index bee12021754b15455ded75b22f25d8b612114128..b25d2133bf1a8bb61dad10aa53890ff8d64925f1 100644 (file)
@@ -1,3 +1,10 @@
+2006-11-08  Vladimir Prus  <vladimir@codesourcery.com>
+
+       * pex-win32.c (no_suffixes): Remove.
+       (std_suffixes): Add "" as first element.
+       (find_executable): Remove detection of already-present
+       extension. Try all suffixes in std_suffixes.
+
 2006-11-07  Vladimir Prus  <vladimir@codesourcery.com>  
 
        * testsuite/ld-elf/symbol2w.s: Use "%" instead
index 45725457b6af76ffb5060c93a13300a1114353b4..59a99eae65ec5fa35719e4a309c278465f89fe92 100644 (file)
@@ -382,16 +382,18 @@ argv_to_cmdline (char *const *argv)
   return cmdline;
 }
 
+/* We'll try the passed filename with all the known standard
+   extensions, and then without extension.  We try no extension
+   last so that we don't try to run some random extension-less
+   file that might be hanging around.  We try both extension
+   and no extension so that we don't need any fancy logic
+   to determine if a file has extension.  */
 static const char *const
 std_suffixes[] = {
   ".com",
   ".exe",
   ".bat",
   ".cmd",
-  0
-};
-static const char *const
-no_suffixes[] = {
   "",
   0
 };
@@ -409,7 +411,6 @@ find_executable (const char *program, BOOL search)
   const char *const *ext;
   const char *p, *q;
   size_t proglen = strlen (program);
-  int has_extension = !!strchr (program, '.');
   int has_slash = (strchr (program, '/') || strchr (program, '\\'));
   HANDLE h;
 
@@ -432,7 +433,7 @@ find_executable (const char *program, BOOL search)
       if (*q == ';')
        q++;
     }
-  fe_len = fe_len + 1 + proglen + (has_extension ? 1 : 5);
+  fe_len = fe_len + 1 + proglen + 5 /* space for extension */;
   full_executable = xmalloc (fe_len);
 
   p = path;
@@ -458,7 +459,7 @@ find_executable (const char *program, BOOL search)
 
       /* At this point, e points to the terminating NUL character for
          full_executable.  */
-      for (ext = has_extension ? no_suffixes : std_suffixes; *ext; ext++)
+      for (ext = std_suffixes; *ext; ext++)
        {
          /* Remove any current extension.  */
          *e = '\0';