aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-04-18 20:15:15 +0300
committerArnold D. Robbins <arnold@skeeve.com>2019-04-18 20:15:15 +0300
commit9abeda33e7ce111a266d5e3ec4dafe65c26d5cd0 (patch)
tree68694f00d403866a7d64c606b93db56155aaf56f /main.c
parent33218616b4987c7afd860d0b3f4dad9cdb703547 (diff)
downloadegawk-9abeda33e7ce111a266d5e3ec4dafe65c26d5cd0.tar.gz
egawk-9abeda33e7ce111a266d5e3ec4dafe65c26d5cd0.tar.bz2
egawk-9abeda33e7ce111a266d5e3ec4dafe65c26d5cd0.zip
Fix core dump upon syntax error.
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.c b/main.c
index d6e34266..8327cc74 100644
--- a/main.c
+++ b/main.c
@@ -1262,6 +1262,9 @@ catchsig(int sig)
|| sig == SIGBUS
#endif
) {
+ if (errcount > 0) // assume a syntax error corrupted our data structures
+ exit(EXIT_FATAL);
+
set_loc(__FILE__, __LINE__);
msg(_("fatal error: internal error"));
/* fatal won't abort() if not compiled for debugging */
@@ -1279,6 +1282,9 @@ catchsig(int sig)
static int
catchsegv(void *fault_address, int serious)
{
+ if (errcount > 0) // assume a syntax error corrupted our data structures
+ exit(EXIT_FATAL);
+
set_loc(__FILE__, __LINE__);
msg(_("fatal error: internal error: segfault"));
fflush(NULL);