]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - lib/exec_shell.c
10 #include "exec_shell.h"
12 #define DEFAULT_SHELL "/bin/sh"
14 void __attribute__((__noreturn__
)) exec_shell(void) {
15 const char *shell
= getenv("SHELL"), *shell_basename
;
18 shell
= DEFAULT_SHELL
;
20 shell_basename
= basename(shell
);
21 arg0
= xmalloc(strlen(shell_basename
) + 2);
23 strcpy(arg0
+ 1, shell_basename
);
25 execl(shell
, arg0
, NULL
);
26 err(EXIT_FAILURE
, _("failed to execute %s"), shell
);