From: Sami Kerola Date: Fri, 28 Dec 2012 21:23:40 +0000 (+0000) Subject: script: search shell from path, when necessary X-Git-Tag: v2.23-rc1~377 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4ff2f54d794be5ca54cd40bcbbce2096f22d177;p=thirdparty%2Futil-linux.git script: search shell from path, when necessary Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532 Signed-off-by: Sami Kerola --- diff --git a/term-utils/script.c b/term-utils/script.c index 94a20da6c3..983930f5cd 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -445,11 +445,17 @@ doshell(void) { */ signal(SIGTERM, SIG_DFL); - if (cflg) - execl(shell, shname, "-c", cflg, NULL); - else - execl(shell, shname, "-i", NULL); - + if (access(shell, X_OK) == 0) { + if (cflg) + execl(shell, shname, "-c", cflg, NULL); + else + execl(shell, shname, "-i", NULL); + } else { + if (cflg) + execlp(shname, "-c", cflg, NULL); + else + execlp(shname, "-i", NULL); + } warn(_("failed to execute %s"), shell); fail(); }