From 76aef28b3147fb5ea944c793452e2d5ca3b348fe Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 15 Jul 2010 18:44:12 +0000 Subject: 28073: allow #! scripts to search path if interpreter not found --- Src/exec.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Src/exec.c') diff --git a/Src/exec.c b/Src/exec.c index 6611e9c79..73b4c01a8 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -461,8 +461,15 @@ zexecve(char *pth, char **argv, char **newenvp) for (ptr = execvebuf + 2; *ptr && *ptr == ' '; ptr++); for (ptr2 = ptr; *ptr && *ptr != ' '; ptr++); if (eno == ENOENT) { + char *pprog; if (*ptr) *ptr = '\0'; + if (*ptr2 != '/' && + (pprog = pathprog(ptr2, NULL))) { + argv[-2] = ptr2; + argv[-1] = ptr + 1; + execve(pprog, argv - 2, newenvp); + } zerr("%s: bad interpreter: %s: %e", pth, ptr2, eno); } else if (*ptr) { -- cgit 1.4.1