Fix path_lookup() when the program to invoke contains a slash.

In this case, no path lookup actually takes place, and the returned
program name is equal to the passed in program name. But this code
path contained a thinko that crashed.
This commit is contained in:
Johannes Sixt
2007-01-24 18:48:14 +01:00
parent 2033ba137a
commit 10c1047e09

View File

@@ -79,9 +79,9 @@ static char *path_lookup(const char *cmd, char **path)
int tryexe = len < 4 || strcasecmp(cmd+len-4, ".exe");
if (strchr(cmd, '/') || strchr(cmd, '\\'))
p = NULL;
prog = xstrdup(cmd);
while (*p && !prog) {
while (!prog && *p) {
prog = lookup_prog(*p++, cmd, tryexe);
}
if (!prog) {