From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 1/4] script: search shell from path, when necessary
Date: Fri, 28 Dec 2012 21:23:40 +0000 [thread overview]
Message-ID: <1356729823-729-1-git-send-email-kerolasa@iki.fi> (raw)
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
next reply other threads:[~2012-12-28 21:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-28 21:23 Sami Kerola [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356729823-729-1-git-send-email-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox