diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-01-16 13:44:18 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-01-16 13:44:18 +0000 |
commit | 757168e2c8af374436108266cc3cfd32a946a590 (patch) | |
tree | 293929274f50de8733f00c4ae561a85e9c5fc16f /Src/utils.c | |
parent | 052316fea3b74599de04fb3990a444b0ba08b04b (diff) | |
download | zsh-757168e2c8af374436108266cc3cfd32a946a590.tar.gz zsh-757168e2c8af374436108266cc3cfd32a946a590.tar.xz zsh-757168e2c8af374436108266cc3cfd32a946a590.zip |
remove 13108 (trap queues); replace with signal queueing to ensure that user signal handlers are only executed when it is safe to run them (13365)
Diffstat (limited to 'Src/utils.c')
-rw-r--r-- | Src/utils.c | 58 |
1 files changed, 21 insertions, 37 deletions
diff --git a/Src/utils.c b/Src/utils.c index 11908435c..3bdaef307 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -691,12 +691,16 @@ preprompt(void) if (mailpath && *mailpath && **mailpath) checkmailpath(mailpath); - else if ((mailfile = getsparam("MAIL")) && *mailfile) { - char *x[2]; - - x[0] = mailfile; - x[1] = NULL; - checkmailpath(x); + else { + queue_signals(); + if ((mailfile = getsparam("MAIL")) && *mailfile) { + char *x[2]; + + x[0] = mailfile; + x[1] = NULL; + checkmailpath(x); + } + unqueue_signals(); } lastmailcheck = time(NULL); } @@ -1091,17 +1095,21 @@ zclose(int fd) mod_export char * gettempname(void) { - char *s; + char *s, *ret; + queue_signals(); if (!(s = getsparam("TMPPREFIX"))) s = DEFAULT_TMPPREFIX; #ifdef HAVE__MKTEMP /* Zsh uses mktemp() safely, so silence the warnings */ - return ((char *) _mktemp(dyncat(unmeta(s), "XXXXXX"))); + ret = ((char *) _mktemp(dyncat(unmeta(s), "XXXXXX"))); #else - return ((char *) mktemp(dyncat(unmeta(s), "XXXXXX"))); + ret = ((char *) mktemp(dyncat(unmeta(s), "XXXXXX"))); #endif + unqueue_signals(); + + return ret; } /* Check if a string contains a token */ @@ -1418,38 +1426,12 @@ checkrmall(char *s) } /**/ -mod_export int -ztrapread(int fd, char *buf, int len) -{ - int ret; - - ALLOWTRAPS { - ret = read(fd, buf, len); - } DISALLOWTRAPS; - - return ret; -} - -/**/ -mod_export int -ztrapwrite(int fd, char *buf, int len) -{ - int ret; - - ALLOWTRAPS { - ret = write(fd, buf, len); - } DISALLOWTRAPS; - - return ret; -} - -/**/ int read1char(void) { char c; - while (ztrapread(SHTTY, &c, 1) != 1) { + while (read(SHTTY, &c, 1) != 1) { if (errno != EINTR || errflag || retflag || breaks || contflag) return -1; } @@ -1467,7 +1449,7 @@ noquery(int purge) ioctl(SHTTY, FIONREAD, (char *)&val); if (purge) { for (; val; val--) - ztrapread(SHTTY, &c, 1); + read(SHTTY, &c, 1); } #endif @@ -2122,12 +2104,14 @@ mod_export void zbeep(void) { char *vb; + queue_signals(); if ((vb = getsparam("ZBEEP"))) { int len; vb = getkeystring(vb, &len, 2, NULL); write(SHTTY, vb, len); } else if (isset(BEEP)) write(SHTTY, "\07", 1); + unqueue_signals(); } /**/ |