From 10c1047e091e93854a5df231b4bf6b2ebdc51d41 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 24 Jan 2007 18:48:14 +0100 Subject: [PATCH] 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. --- spawn-pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spawn-pipe.c b/spawn-pipe.c index b828809820..b4c2538b04 100644 --- a/spawn-pipe.c +++ b/spawn-pipe.c @@ -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) {