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:
David Herrmann 2012-03-25 16:22:27 +02:00
parent b1cb8c918c
commit c0030f47c2

View File

@ -41,6 +41,7 @@
#define LOG_SUBSYSTEM "config"
struct conf_obj conf_global;
static char *def_argv[] = { NULL, "-i", NULL };
static void print_help()
{
@ -149,7 +150,8 @@ done:
conf_global.argv = &argv[optind];
} else {
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)
fprintf(stderr, "Unparsed remaining arguments\n");
}