summaryrefslogtreecommitdiff
path: root/bin/ed
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-04-17 16:17:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-04-17 16:17:04 +0000
commit1457ac0356bd294a58ec561292bf5ba6bd79200e (patch)
tree06484be30b51bc002ff75c6a32eb2f6ab2087a4d /bin/ed
parent6ed630b25611708a236d5844481836e5d8d8bf42 (diff)
mark signal race
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 0ab46ac1feb..40299ec4723 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.28 2003/06/11 23:42:12 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.29 2006/04/17 16:17:03 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -39,7 +39,7 @@ char *copyright =
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.28 2003/06/11 23:42:12 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.29 2006/04/17 16:17:03 deraadt Exp $";
#endif
#endif /* not lint */
@@ -95,9 +95,11 @@ int mutex = 0; /* if set, signals set "sigflags" */
int red = 0; /* if set, restrict shell/directory access */
int scripted = 0; /* if set, suppress diagnostics */
int sigflags = 0; /* if set, signals received while mutex set */
-int sigactive = 0; /* if set, signal handlers are enabled */
int interactive = 0; /* if set, we are in interactive mode */
+/* if set, signal handlers are enabled */
+volatile sig_atomic_t sigactive = 0;
+
char old_filename[MAXPATHLEN] = ""; /* default filename */
int current_addr; /* current address in editor buffer */
int addr_last; /* last address in editor buffer */
@@ -1417,6 +1419,7 @@ handle_hup(int signo)
if (!sigactive)
quit(1);
sigflags &= ~(1 << (signo - 1));
+ /* XXX signal race */
if (addr_last && write_file("ed.hup", "w", 1, addr_last) < 0 &&
home != NULL &&
strlen(home) + sizeof("/ed.hup") <= MAXPATHLEN) {