summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2018-07-04 11:00:58 +0200
committerKarel Zak2018-07-04 11:00:58 +0200
commit805400c7303c2914ec533b278c16a7454d19706d (patch)
treeef020d537cc958c55467217373043af8e87a1b45 /lib
parentMerge branch 'fixes' of https://github.com/rudimeier/util-linux (diff)
parentexec_shell: prevent ".: applet not found" error when SHELL env is not set. (diff)
downloadkernel-qcow2-util-linux-805400c7303c2914ec533b278c16a7454d19706d.tar.gz
kernel-qcow2-util-linux-805400c7303c2914ec533b278c16a7454d19706d.tar.xz
kernel-qcow2-util-linux-805400c7303c2914ec533b278c16a7454d19706d.zip
Merge branch 'quick-fix-20180625' of https://github.com/sjitech/util-linux
* 'quick-fix-20180625' of https://github.com/sjitech/util-linux: exec_shell: prevent ".: applet not found" error when SHELL env is not set.
Diffstat (limited to 'lib')
-rw-r--r--lib/exec_shell.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/exec_shell.c b/lib/exec_shell.c
index 49b7df5bf..18798ebe4 100644
--- a/lib/exec_shell.c
+++ b/lib/exec_shell.c
@@ -33,13 +33,14 @@
void __attribute__((__noreturn__)) exec_shell(void)
{
const char *shell = getenv("SHELL");
- char *shellc = xstrdup(shell);
+ char *shellc;
const char *shell_basename;
char *arg0;
if (!shell)
shell = DEFAULT_SHELL;
+ shellc = xstrdup(shell);
shell_basename = basename(shellc);
arg0 = xmalloc(strlen(shell_basename) + 2);
arg0[0] = '-';