summaryrefslogtreecommitdiff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
commitd799ac78a744a5359563af55b4dee9e91255a1dc (patch)
tree73475ed7089e6ee050085a96b88018994b43bdfc /Src/utils.c
parentabfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff)
parent375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff)
downloadzsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz
zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 26e2a5c2c..d1d9406c2 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1287,9 +1287,17 @@ void
preprompt(void)
{
static time_t lastperiodic;
+ time_t currentmailcheck;
LinkNode ln;
- int period = getiparam("PERIOD");
- int mailcheck = getiparam("MAILCHECK");
+ zlong period = getiparam("PERIOD");
+ zlong mailcheck = getiparam("MAILCHECK");
+
+ /*
+ * Handle any pending window size changes before we compute prompts,
+ * then block them again to avoid interrupts during prompt display.
+ */
+ winch_unblock();
+ winch_block();
if (isset(PROMPTSP) && isset(PROMPTCR) && !use_exit_printed && shout) {
/* The PROMPT_SP heuristic will move the prompt down to a new line
@@ -1330,7 +1338,7 @@ preprompt(void)
/* If 1) the parameter PERIOD exists, 2) a hook function for *
* "periodic" exists, 3) it's been greater than PERIOD since we *
* executed any such hook, then execute it now. */
- if (period && (time(NULL) > lastperiodic + period) &&
+ if (period && ((zlong)time(NULL) > (zlong)lastperiodic + period) &&
!callhookfunc("periodic", NULL, 1, NULL))
lastperiodic = time(NULL);
if (errflag)
@@ -1348,7 +1356,9 @@ preprompt(void)
return;
/* Check mail */
- if (mailcheck && (int) difftime(time(NULL), lastmailcheck) > mailcheck) {
+ currentmailcheck = time(NULL);
+ if (mailcheck &&
+ (zlong) difftime(currentmailcheck, lastmailcheck) > mailcheck) {
char *mailfile;
if (mailpath && *mailpath && **mailpath)
@@ -1364,7 +1374,7 @@ preprompt(void)
}
unqueue_signals();
}
- lastmailcheck = time(NULL);
+ lastmailcheck = currentmailcheck;
}
if (prepromptfns) {
@@ -1424,7 +1434,7 @@ checkmailpath(char **s)
}
} else if (shout) {
if (st.st_size && st.st_atime <= st.st_mtime &&
- st.st_mtime > lastmailcheck) {
+ st.st_mtime >= lastmailcheck) {
if (!u) {
fprintf(shout, "You have new mail.\n");
fflush(shout);