conf: fix local storage of default argv
We assigned stack-storage to a global pointer and therefore we got seg-faults when using the default. Fix that. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
b1cb8c918c
commit
c0030f47c2
@ -41,6 +41,7 @@
|
|||||||
#define LOG_SUBSYSTEM "config"
|
#define LOG_SUBSYSTEM "config"
|
||||||
|
|
||||||
struct conf_obj conf_global;
|
struct conf_obj conf_global;
|
||||||
|
static char *def_argv[] = { NULL, "-i", NULL };
|
||||||
|
|
||||||
static void print_help()
|
static void print_help()
|
||||||
{
|
{
|
||||||
@ -149,7 +150,8 @@ done:
|
|||||||
conf_global.argv = &argv[optind];
|
conf_global.argv = &argv[optind];
|
||||||
} else {
|
} else {
|
||||||
conf_global.login = getenv("SHELL") ? : _PATH_BSHELL;
|
conf_global.login = getenv("SHELL") ? : _PATH_BSHELL;
|
||||||
conf_global.argv = (char*[]){ conf_global.login, "-i", NULL };
|
def_argv[0] = conf_global.login;
|
||||||
|
conf_global.argv = def_argv;
|
||||||
if (optind != argc)
|
if (optind != argc)
|
||||||
fprintf(stderr, "Unparsed remaining arguments\n");
|
fprintf(stderr, "Unparsed remaining arguments\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user