From 7f79adb3429efe130ceb1b32032a1925abe66d76 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Thu, 11 Feb 2016 03:45:11 +0100 Subject: [PATCH] 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 --- lib/exec_shell.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.47.2