From b4ff2f54d794be5ca54cd40bcbbce2096f22d177 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 28 Dec 2012 21:23:40 +0000 Subject: [PATCH] script: search shell from path, when necessary Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532 Signed-off-by: Sami Kerola --- term-utils/script.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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(); } -- 2.47.2