summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alpine/osdep/debuging.c2
-rw-r--r--alpine/signal.c2
-rw-r--r--pith/adrbklib.c6
-rw-r--r--pith/help.c6
-rw-r--r--pith/imap.c2
-rw-r--r--pith/newmail.c14
-rw-r--r--pith/osdep/debugtime.c5
-rw-r--r--pith/osdep/debugtime.h2
-rw-r--r--pith/pine.hlp4
-rw-r--r--pith/state.h1
-rw-r--r--pith/stream.c20
11 files changed, 37 insertions, 27 deletions
diff --git a/alpine/osdep/debuging.c b/alpine/osdep/debuging.c
index a86690df..74b7190f 100644
--- a/alpine/osdep/debuging.c
+++ b/alpine/osdep/debuging.c
@@ -276,7 +276,7 @@ do_debug(FILE *debug_fp)
}
if(ok && ps_global->debug_timestamp)
- fprintf(debug_fp, "\n%s\n", debug_time(0, ps_global->debug_timestamp));
+ fprintf(debug_fp, "\n%s\n", debug_time(0, ps_global->debug_timestamp, ps_global->signal_in_progress));
return(ok);
}
diff --git a/alpine/signal.c b/alpine/signal.c
index 158612d2..6adc63c9 100644
--- a/alpine/signal.c
+++ b/alpine/signal.c
@@ -238,6 +238,8 @@ Not much to do. Rely on periodic mail file check pointing.
RETSIGTYPE
hup_signal(void)
{
+ if(ps_global)
+ ps_global->signal_in_progress = 1;
end_signals(1); /* don't catch any more signals */
dprint((1, "\n\n** Received SIGHUP **\n\n\n\n"));
cleanup_called_from_sig_handler = 1;
diff --git a/pith/adrbklib.c b/pith/adrbklib.c
index 92796142..88f29e73 100644
--- a/pith/adrbklib.c
+++ b/pith/adrbklib.c
@@ -5602,7 +5602,7 @@ adrbk_check_and_fix(PerAddrBook *pab, int safe, int low_freq, int check_now)
int save_rem_abook_valid = 0;
dprint((2, "adrbk_check_and_fix %s: fixing %s\n",
- debug_time(0,0),
+ debug_time(0,0,ps_global->signal_in_progress),
pab->filename ? pab->filename : "?"));
if(ab_nesting_level > 0){
q_status_message3(SM_ORDER, 0, 2,
@@ -5761,7 +5761,7 @@ adrbk_maintenance(void)
if(now > pab->address_book->rd->last_use + IMAP_IDLE_TIMEOUT){
dprint((2,
"adrbk_maint %s: closing idle (%ld secs) connection: %s\n",
- debug_time(0,0),
+ debug_time(0,0,ps_global->signal_in_progress),
(long)(now - pab->address_book->rd->last_use),
pab->address_book->orig_filename
? pab->address_book->orig_filename : "?"));
@@ -5792,7 +5792,7 @@ adrbk_maintenance(void)
else if(!rd_ping_stream(pab->address_book->rd)){
dprint((2,
"adrbk_maint: %s: abook stream closed unexpectedly: %s\n",
- debug_time(0,0),
+ debug_time(0,0,ps_global->signal_in_progress),
pab->address_book->orig_filename
? pab->address_book->orig_filename : "?"));
}
diff --git a/pith/help.c b/pith/help.c
index ff8881df..af972fcd 100644
--- a/pith/help.c
+++ b/pith/help.c
@@ -318,7 +318,7 @@ add_review_message(char *message, int level)
strncpy(rmjoarray[rmjolast].message, p, MIN(q-p,RMMSGLEN));
#ifdef DEBUG
memset(rmjoarray[rmjolast].timestamp, 0, (RMTIMLEN+1)*sizeof(char));
- strncpy(rmjoarray[rmjolast].timestamp, debug_time(0,1), RMTIMLEN);
+ strncpy(rmjoarray[rmjolast].timestamp, debug_time(0,1,ps_global->signal_in_progress), RMTIMLEN);
#endif
}
else if(level <= 4){
@@ -339,7 +339,7 @@ add_review_message(char *message, int level)
strncpy(rmloarray[rmlolast].message, p, MIN(q-p,RMMSGLEN));
#ifdef DEBUG
memset(rmloarray[rmlolast].timestamp, 0, (RMTIMLEN+1)*sizeof(char));
- strncpy(rmloarray[rmlolast].timestamp, debug_time(0,1), RMTIMLEN);
+ strncpy(rmloarray[rmlolast].timestamp, debug_time(0,1,ps_global->signal_in_progress), RMTIMLEN);
#endif
}
else{
@@ -360,7 +360,7 @@ add_review_message(char *message, int level)
strncpy(rmhiarray[rmhilast].message, p, MIN(q-p,RMMSGLEN));
#ifdef DEBUG
memset(rmhiarray[rmhilast].timestamp, 0, (RMTIMLEN+1)*sizeof(char));
- strncpy(rmhiarray[rmhilast].timestamp, debug_time(0,1), RMTIMLEN);
+ strncpy(rmhiarray[rmhilast].timestamp, debug_time(0,1,ps_global->signal_in_progress), RMTIMLEN);
#endif
}
}
diff --git a/pith/imap.c b/pith/imap.c
index e02f46ba..cc58dbc9 100644
--- a/pith/imap.c
+++ b/pith/imap.c
@@ -567,7 +567,7 @@ mm_dlog(char *string)
dprint(((ps_global->debug_imap >= 4 && debug < 4) ? debug : 4,
"IMAP DEBUG %s%s: %s\n",
continued ? continued : "",
- debug_time(1, ps_global->debug_timestamp), p ? p : "?"));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress), p ? p : "?"));
#ifdef DEBUGJOURNAL
}
#endif
diff --git a/pith/newmail.c b/pith/newmail.c
index 333d0da6..95b5608c 100644
--- a/pith/newmail.c
+++ b/pith/newmail.c
@@ -240,7 +240,7 @@ new_mail(int force_arg, CheckPointTime time_for_check_point, int flags)
? " [expunged reaper]"
: " [keepalive]",
m == ps_global->mail_stream ? " [current]" : "",
- debug_time(0,1)));
+ debug_time(0,1,ps_global->signal_in_progress)));
/*
* We're about to ping the stream.
@@ -262,7 +262,7 @@ new_mail(int force_arg, CheckPointTime time_for_check_point, int flags)
sp_set_dead_stream(m, 1);
}
- dprint((7, "Ping complete: %s\n", debug_time(0,1)));
+ dprint((7, "Ping complete: %s\n", debug_time(0,1,ps_global->signal_in_progress)));
if((flags & NM_STATUS_MSG) && pith_opt_newmail_check_cue)
(*pith_opt_newmail_check_cue)(FALSE);
@@ -300,7 +300,7 @@ new_mail(int force_arg, CheckPointTime time_for_check_point, int flags)
*/
if((time(0) - now >= 5) && have_pinged_non_special){
dprint((7, "skipping pings due to delay: %s\n",
- debug_time(0,1)));
+ debug_time(0,1,ps_global->signal_in_progress)));
break;
}
@@ -415,7 +415,7 @@ new_mail(int force_arg, CheckPointTime time_for_check_point, int flags)
&& (now-sp_last_ping(m) >= expunged_reaper_to))
? " [slow ping]" : " [keepalive]",
since_last_input,
- debug_time(0,1)));
+ debug_time(0,1,ps_global->signal_in_progress)));
/*
* We're about to ping the stream.
@@ -437,7 +437,7 @@ new_mail(int force_arg, CheckPointTime time_for_check_point, int flags)
sp_set_dead_stream(m, 1);
}
- dprint((7, "Ping complete: %s\n", debug_time(0,1)));
+ dprint((7, "Ping complete: %s\n", debug_time(0,1,ps_global->signal_in_progress)));
if((flags & NM_STATUS_MSG) && pith_opt_newmail_check_cue)
(*pith_opt_newmail_check_cue)(FALSE);
@@ -840,7 +840,7 @@ check_point(MAILSTREAM *stream, CheckPointTime timing, int flags)
|| time(0) - sp_last_chkpnt_done(stream) >= AT_LEAST){
then = time(0);
dprint((2, "Checkpoint: %s Since 1st change: %ld secs idle: %ld secs\n",
- debug_time(0,1),
+ debug_time(0,1,ps_global->signal_in_progress),
(long) (then - sp_first_status_change(stream)),
since_last_input))
;
@@ -852,7 +852,7 @@ check_point(MAILSTREAM *stream, CheckPointTime timing, int flags)
now = time(0);
dprint((2,
"Checkpoint complete: %s%s%s%s\n",
- debug_time(0,1),
+ debug_time(0,1,ps_global->signal_in_progress),
(now-then > 0) ? " (elapsed: " : "",
(now-then > 0) ? comatose((long)(now-then)) : "",
(now-then > 0) ? " secs)" : ""));
diff --git a/pith/osdep/debugtime.c b/pith/osdep/debugtime.c
index a1ee3b2a..09fc5c30 100644
--- a/pith/osdep/debugtime.c
+++ b/pith/osdep/debugtime.c
@@ -29,7 +29,7 @@ static char rcsid[] = "$Id: debugtime.c 770 2007-10-24 00:23:09Z hubert@u.washin
* If include_date is set the date is appended.
*/
char *
-debug_time(int include_date, int include_subseconds)
+debug_time(int include_date, int include_subseconds, int signal_in_progress)
{
time_t t;
struct tm *tm_now;
@@ -43,6 +43,9 @@ debug_time(int include_date, int include_subseconds)
char subsecond[8];
char datestr[7];
+ if(signal_in_progress)
+ return _("Time Unavailable");
+
timestring[0] = '\0';
#if HAVE_GETTIMEOFDAY
diff --git a/pith/osdep/debugtime.h b/pith/osdep/debugtime.h
index 6a3eda1e..9e663952 100644
--- a/pith/osdep/debugtime.h
+++ b/pith/osdep/debugtime.h
@@ -22,7 +22,7 @@
* Exported Prototypes
*/
#ifdef DEBUG
-char *debug_time(int, int);
+char *debug_time(int, int, int);
#endif
int get_time(TIMEVAL_S *);
long time_diff(TIMEVAL_S *, TIMEVAL_S *);
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 78054ff1..36947fb6 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -373,6 +373,10 @@ Bugs that have been addressed include:
of the certificate to lowercase, which may make Alpine not be able
to read such certificate. Reported by Dennis Davis.
+ <LI> Work in progress: Avoid calling non-safe functions when Alpine
+ receives a signal. See bug report
+ <A HREF="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825772">here.</A>
+
<LI> Crash when attempting to read a message after a bounce command.
In order to produce a crash one needed to use the ^T subcommand and
do a search in a LDAP directory. The crash is produced by changes
diff --git a/pith/state.h b/pith/state.h
index 53db2bf9..f6b85d9b 100644
--- a/pith/state.h
+++ b/pith/state.h
@@ -121,6 +121,7 @@ struct pine {
char *folders_dir;
+ unsigned signal_in_progress:1; /* we are handling a signal */
unsigned mangled_footer:1; /* footer needs repainting */
unsigned mangled_header:1; /* header needs repainting */
unsigned mangled_body:1; /* body of screen needs repainting */
diff --git a/pith/stream.c b/pith/stream.c
index 7a783552..00460d8d 100644
--- a/pith/stream.c
+++ b/pith/stream.c
@@ -114,7 +114,7 @@ pine_mail_open(MAILSTREAM *stream, char *mailbox, long int openflags, long int *
openflags & SP_USERFLDR ? " SP_USERFLDR" : "",
openflags & SP_USEPOOL ? " SP_USEPOOL" : "",
openflags & SP_TEMPUSE ? " SP_TEMPUSE" : "",
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
if(retflags)
*retflags = 0L;
@@ -569,7 +569,7 @@ pine_mail_open(MAILSTREAM *stream, char *mailbox, long int openflags, long int *
&& !strcmp(stream->dtb->name, "imap")){
dprint((7,
"pine_mail_open: cancel idle timer: TAG %08lx (%s)\n",
- stream->gensym, debug_time(1, ps_global->debug_timestamp)));
+ stream->gensym, debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
}
/*
@@ -1247,7 +1247,7 @@ pine_mail_close(MAILSTREAM *stream)
dprint((7, "pine_mail_close: %s (%s)\n",
stream && stream->mailbox ? stream->mailbox : "(NULL)",
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
if(sp_flagged(stream, SP_USEPOOL) && !sp_dead_stream(stream)){
@@ -1296,7 +1296,7 @@ pine_mail_close(MAILSTREAM *stream)
if(refcnt <= 0){
dprint((7,
"pine_mail_close: unlocking: start idle timer: TAG %08lx (%s)\n",
- stream->gensym, debug_time(1, ps_global->debug_timestamp)));
+ stream->gensym, debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
sp_set_last_use_time(stream, time(0));
/*
@@ -1350,7 +1350,7 @@ pine_mail_actually_close(MAILSTREAM *stream)
if(!sp_closing(stream)){
dprint((7, "pine_mail_actually_close: %s (%s)\n",
stream && stream->mailbox ? stream->mailbox : "(NULL)",
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
sp_set_closing(stream, 1);
@@ -1386,7 +1386,7 @@ maybe_kill_old_stream(MAILSTREAM *stream)
dprint((7,
"killing idle stream: %s (%s): idle timer = %ld secs\n",
stream && stream->mailbox ? stream->mailbox : "(NULL)",
- debug_time(1, ps_global->debug_timestamp),
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress),
(long) (time(0)-sp_last_use_time(stream))));
/*
@@ -2580,7 +2580,7 @@ sp_stream_get(char *mailbox, long unsigned int flags)
dprint((7,
"reset idle timer1: next TAG %08lx (%s)\n",
m->gensym,
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
sp_set_last_use_time(m, time(0));
}
@@ -2635,7 +2635,7 @@ sp_stream_get(char *mailbox, long unsigned int flags)
dprint((7,
"reset idle timer4: next TAG %08lx (%s)\n",
m->gensym,
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
sp_set_last_use_time(m, time(0));
return(m);
@@ -2663,7 +2663,7 @@ sp_stream_get(char *mailbox, long unsigned int flags)
dprint((7,
"reset idle timer2: next TAG %08lx (%s)\n",
m->gensym,
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
sp_set_last_use_time(m, time(0));
return(m);
}
@@ -2696,7 +2696,7 @@ sp_stream_get(char *mailbox, long unsigned int flags)
dprint((7,
"reset idle timer3: next TAG %08lx (%s)\n",
m->gensym,
- debug_time(1, ps_global->debug_timestamp)));
+ debug_time(1, ps_global->debug_timestamp, ps_global->signal_in_progress)));
sp_set_last_use_time(m, time(0));
return(m);
}