From: Ruediger Meier Date: Thu, 11 Feb 2016 02:45:11 +0000 (+0100) Subject: exec_shell: prevent basename from modifying env X-Git-Tag: v2.28-rc1~108^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f79adb3429efe130ceb1b32032a1925abe66d76;p=thirdparty%2Futil-linux.git 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 --- diff --git a/lib/exec_shell.c b/lib/exec_shell.c index 2b723acb4c..a7374bd334 100644 --- a/lib/exec_shell.c +++ b/lib/exec_shell.c @@ -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);