Skip to content
Snippets Groups Projects
Commit d7c63689 authored by Simon Marlow's avatar Simon Marlow Committed by pcapriotti
Browse files

hs_init(): cope with argc and/or argv being NULL (#6006)

MERGED from commit 4ca28182
parent 0e069310
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,14 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) ...@@ -141,7 +141,14 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
defaultsHook(); defaultsHook();
/* Parse the flags, separating the RTS flags from the programs args */ /* Parse the flags, separating the RTS flags from the programs args */
if (argc != NULL && argv != NULL) { if (argc == NULL || argv == NULL) {
// Use a default for argc & argv if either is not supplied
int my_argc = 1;
char *my_argv[] = { "<unknown>", NULL };
setFullProgArgv(my_argc,my_argv);
setupRtsFlags(&my_argc, my_argv,
rts_config.rts_opts_enabled, rts_config.rts_opts);
} else {
setFullProgArgv(*argc,*argv); setFullProgArgv(*argc,*argv);
setupRtsFlags(argc, *argv, setupRtsFlags(argc, *argv,
rts_config.rts_opts_enabled, rts_config.rts_opts); rts_config.rts_opts_enabled, rts_config.rts_opts);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment