conf: fix local storage of default argv
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 25 Mar 2012 14:22:27 +0000 (16:22 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 25 Mar 2012 14:22:27 +0000 (16:22 +0200)
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>
src/conf.c

index 057fdd7..c124317 100644 (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");
        }