exec_shell: prevent basename from modifying env
Fix warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
parent
4a04d7f3d6
commit
7f79adb342
1 changed files with 5 additions and 2 deletions
|
@ -32,12 +32,15 @@
|
|||
|
||||
void exec_shell(void)
|
||||
{
|
||||
const char *shell = getenv("SHELL"), *shell_basename;
|
||||
const char *shell = getenv("SHELL");
|
||||
char *shellc = xstrdup(shell);
|
||||
const char *shell_basename;
|
||||
char *arg0;
|
||||
|
||||
if (!shell)
|
||||
shell = DEFAULT_SHELL;
|
||||
|
||||
shell_basename = basename(shell);
|
||||
shell_basename = basename(shellc);
|
||||
arg0 = xmalloc(strlen(shell_basename) + 2);
|
||||
arg0[0] = '-';
|
||||
strcpy(arg0 + 1, shell_basename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue