diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-11-07 11:42:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-11-07 11:42:54 +0000 |
commit | ae080d1b56ffb8232afb44ca6a0be2d49f6a27d4 (patch) | |
tree | 5909da2a24f8b5c4c35bf53929e86bd2030983c5 /usr.bin/yacc/main.c | |
parent | 66b28d8054a25ae461dc6434a89ada07a556253f (diff) |
fix signal race
Diffstat (limited to 'usr.bin/yacc/main.c')
-rw-r--r-- | usr.bin/yacc/main.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c index e9fdb794046..6839b076928 100644 --- a/usr.bin/yacc/main.c +++ b/usr.bin/yacc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.12 2001/07/16 06:29:44 pvalchev Exp $ */ +/* $OpenBSD: main.c,v 1.13 2001/11/07 11:42:53 deraadt Exp $ */ /* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */ /* @@ -47,7 +47,7 @@ char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.12 2001/07/16 06:29:44 pvalchev Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.13 2001/11/07 11:42:53 deraadt Exp $"; #endif #endif /* not lint */ @@ -123,13 +123,20 @@ void getargs __P((int, register char *[])); void create_file_names __P((void)); void open_files __P((void)); +volatile sig_atomic_t sigdie; + void done(k) int k; { - if (action_file) { fclose(action_file); unlink(action_file_name); } - if (text_file) { fclose(text_file); unlink(text_file_name); } - if (union_file) { fclose(union_file); unlink(union_file_name); } + if (action_file) + unlink(action_file_name); + if (text_file) + unlink(text_file_name); + if (union_file) + unlink(union_file_name); + if (sigdie) + _exit(k); exit(k); } @@ -138,7 +145,8 @@ void onintr(signo) int signo; { - done(1); /* XXX signal race */ + sigdie = 1; + done(1); } |