summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2021-07-09 10:20:38 +0000
committerGitHub <noreply@github.com>2021-07-09 10:20:38 +0000
commit43fccb587082af7d6563a6888ce1ad74c7d2f381 (patch)
treed80016a565c2f3fdf4c08a68a083992188bde40e
parentc75b6982397afe85f83d8a81d220c3290d5fe60d (diff)
parent1c530126810655b645951da50a8f1863312419b0 (diff)
downloadgenimage-43fccb587082af7d6563a6888ce1ad74c7d2f381.tar.gz
genimage-43fccb587082af7d6563a6888ce1ad74c7d2f381.tar.xz
Merge pull request #161 from marckleinebudde/use-SHELL
util: systemp(): use shell defined in SHELL rather than /bin/sh
-rw-r--r--util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/util.c b/util.c
index 92b4fca..f827ad7 100644
--- a/util.c
+++ b/util.c
@@ -216,6 +216,7 @@ int systemp(struct image *image, const char *fmt, ...)
pid = fork();
if (!pid) {
+ const char *shell;
int fd;
if (loglevel() < 1) {
@@ -230,7 +231,11 @@ int systemp(struct image *image, const char *fmt, ...)
dup2(STDERR_FILENO, STDOUT_FILENO);
}
- ret = execl("/bin/sh", "sh", "-c", buf, NULL);
+ shell = getenv("SHELL");
+ if (!shell || shell[0] == 0x0)
+ shell = "/bin/sh";
+
+ ret = execl(shell, shell, "-c", buf, NULL);
if (ret < 0) {
ret = -errno;
error("Cannot execute %s: %s\n", buf, strerror(errno));