summaryrefslogtreecommitdiff
path: root/usr.bin/mail/collect.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-05-04 05:37:54 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-05-04 05:37:54 +0000
commit7c88b13a799889e879308794cf19b7522908d8df (patch)
tree0fecff7fd89b96609ed82fda93e33ca1cd6a5b82 /usr.bin/mail/collect.c
parenta69cca63880811a6afaeb7a83b0dcc60b94ae4b0 (diff)
Never remove a mail spool, as we may not have proper prics, just truncate. Also block signals in a few critical areas
Diffstat (limited to 'usr.bin/mail/collect.c')
-rw-r--r--usr.bin/mail/collect.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c
index c4ee500e718..8f5492c1728 100644
--- a/usr.bin/mail/collect.c
+++ b/usr.bin/mail/collect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: collect.c,v 1.15 1997/11/14 00:23:45 millert Exp $ */
+/* $OpenBSD: collect.c,v 1.16 1998/05/04 05:37:47 millert Exp $ */
/* $NetBSD: collect.c,v 1.9 1997/07/09 05:25:45 mikel Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94";
#else
-static char rcsid[] = "$OpenBSD: collect.c,v 1.15 1997/11/14 00:23:45 millert Exp $";
+static char rcsid[] = "$OpenBSD: collect.c,v 1.16 1998/05/04 05:37:47 millert Exp $";
#endif
#endif /* not lint */
@@ -631,22 +631,29 @@ void
collint(s)
int s;
{
+ sigset_t set, oset;
+
/*
* the control flow is subtle, because we can be called from ~q.
*/
+ (void)sigfillset(&set);
+ (void)sigprocmask(SIG_BLOCK, &set, &oset);
if (hadintr == 0 && isatty(0)) {
if (value("ignore") != NULL) {
puts("@");
fflush(stdout);
clearerr(stdin);
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
return;
}
hadintr = 1;
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
siglongjmp(colljmp, 1);
}
rewind(collf);
if (value("nosave") == NULL)
savedeadletter(collf);
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
siglongjmp(collabort, 1);
}
@@ -655,6 +662,10 @@ void
collhup(s)
int s;
{
+ sigset_t set;
+
+ (void)sigfillset(&set);
+ (void)sigprocmask(SIG_BLOCK, &set, NULL);
rewind(collf);
savedeadletter(collf);
/*