summaryrefslogtreecommitdiff
path: root/usr.bin/yacc/main.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2020-05-21 16:22:27 +0000
committerMarc Espie <espie@cvs.openbsd.org>2020-05-21 16:22:27 +0000
commitb3627c0e9b5c15b32a9fa53ac1d04bd3def065f1 (patch)
tree8595a240b40def5ad4ed531042f495f15d6f6052 /usr.bin/yacc/main.c
parent99c3e350d94b467095485362b15c57f07b7a29e7 (diff)
separate cleanup from exit/signal logic
okay deraadt@
Diffstat (limited to 'usr.bin/yacc/main.c')
-rw-r--r--usr.bin/yacc/main.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c
index 4d013ba14e1..5f07c8a6a8b 100644
--- a/usr.bin/yacc/main.c
+++ b/usr.bin/yacc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.30 2020/05/21 16:13:23 espie Exp $ */
+/* $OpenBSD: main.c,v 1.31 2020/05/21 16:22:26 espie Exp $ */
/* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */
/*
@@ -103,11 +103,10 @@ void usage(void);
void getargs(int, char *[]);
void create_file_names(void);
void open_files(void);
-
-volatile sig_atomic_t sigdie;
+void cleanup_temp_files(void);
void
-done(int k)
+cleanup_temp_files()
{
if (action_file)
unlink(action_file_name);
@@ -115,17 +114,20 @@ done(int k)
unlink(text_file_name);
if (union_file)
unlink(union_file_name);
- if (sigdie)
- _exit(k);
- exit(k);
}
+void
+done(int k)
+{
+ cleanup_temp_files();
+ exit(k);
+}
void
onintr(__unused int signo)
{
- sigdie = 1;
- done(1);
+ cleanup_temp_files();
+ _exit(1);
}