summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-04-27 13:20:56 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-04-27 13:20:56 +0100
commit4ca281829c70331571291ed3dcf813a6028cc904 (patch)
tree4a96359c38d1aa3c67742ed67cb7ba2a9b02a112 /rts
parentb6e28266cf29bfdf07fe08e894df77b400da8a04 (diff)
downloadhaskell-4ca281829c70331571291ed3dcf813a6028cc904.tar.gz
hs_init(): cope with argc and/or argv being NULL (#6006)
Diffstat (limited to 'rts')
-rw-r--r--rts/RtsStartup.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 4b9f6ba115..307a691352 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -141,7 +141,14 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
defaultsHook();
/* 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);
setupRtsFlags(argc, *argv,
rts_config.rts_opts_enabled, rts_config.rts_opts);