aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2006-11-08 18:16:27 +0000
committerVladimir Prus <vladimir@codesourcery.com>2006-11-08 18:16:27 +0000
commita77fa47cf6cd3acbdc543f1b7f48cd6d707d080b (patch)
tree1aa965afd8e6b4c76d2cee2014032af08434efbc /libiberty
parent3b548a6f280a1dbcdb7279cf7b26be68800a9e36 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@118595 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog7
-rw-r--r--libiberty/pex-win32.c15
2 files changed, 15 insertions, 7 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 671d0aa619f..592954b3c47 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -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 Julian Brown <julian@codesourcery.com>
* floatformat.c (get_field): Fix segfault with little-endian word
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 90a9ed1f950..ef9eb025caf 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -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 = XNEWVEC (char, 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';