diff options
Diffstat (limited to 'Src/init.c')
-rw-r--r-- | Src/init.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Src/init.c b/Src/init.c index 102276a64..22db4b3b2 100644 --- a/Src/init.c +++ b/Src/init.c @@ -105,6 +105,7 @@ loop(int toplevel, int justonce) Eprog prog; int err, non_empty = 0; + queue_signals(); pushheap(); if (!toplevel) zcontext_save(); @@ -218,6 +219,7 @@ loop(int toplevel, int justonce) if (((!interact || sourcelevel) && errflag) || retflag) break; if (isset(SINGLECOMMAND) && toplevel) { + dont_queue_signals(); if (sigtrapped[SIGEXIT]) dotrap(SIGEXIT); exit(lastval); @@ -229,6 +231,7 @@ loop(int toplevel, int justonce) if (!toplevel) zcontext_restore(); popheap(); + unqueue_signals(); if (err) return LOOP_ERROR; @@ -1117,8 +1120,9 @@ setupshin(char *runscript) exit(127); } scriptfilename = sfname; - zsfree(argzero); /* ztrdup'd in parseargs */ - argzero = runscript; + sfname = argzero; /* copy to avoid race condition */ + argzero = ztrdup(runscript); + zsfree(sfname); /* argzero ztrdup'd in parseargs */ } /* * We only initialise line numbering once there is a script to @@ -1425,7 +1429,7 @@ sourcehome(char *s) char *h; queue_signals(); - if (EMULATION(EMULATE_SH|EMULATE_KSH) || !(h = getsparam("ZDOTDIR"))) { + if (EMULATION(EMULATE_SH|EMULATE_KSH) || !(h = getsparam_u("ZDOTDIR"))) { h = home; if (!h) return; |