public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] script: search shell from path, when necessary
@ 2012-12-28 21:23 Sami Kerola
  2012-12-28 21:23 ` [PATCH 2/4] ipcs: fix spacing in summary output Sami Kerola
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sami Kerola @ 2012-12-28 21:23 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 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 94a20da..983930f 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();
 }
-- 
1.8.0.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-09 13:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-28 21:23 [PATCH 1/4] script: search shell from path, when necessary Sami Kerola
2012-12-28 21:23 ` [PATCH 2/4] ipcs: fix spacing in summary output Sami Kerola
2013-01-09 13:20   ` Karel Zak
2012-12-28 21:23 ` [PATCH 3/4] swapon: default to --show if nothing is requested Sami Kerola
2013-01-09 13:21   ` Karel Zak
2012-12-28 21:23 ` [PATCH 4/4] losetup: fix declarations [smatch scan] Sami Kerola
2013-01-09 13:36   ` Karel Zak
2013-01-09 12:47 ` [PATCH 1/4] script: search shell from path, when necessary Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox