From 7f5916d4809fa48df53cc960618772e5dba86989 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Mon, 24 Apr 2017 06:36:17 -0700 Subject: [PATCH] [crash] call endwin() after a crash Fixes #438 --- src/lnav_log.cc | 6 ++++++ src/log_format_loader.cc | 1 + test/Makefile.am | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/lnav_log.cc b/src/lnav_log.cc index 0ccdf5fc..7e97edcb 100644 --- a/src/lnav_log.cc +++ b/src/lnav_log.cc @@ -57,14 +57,19 @@ #if defined HAVE_NCURSESW_CURSES_H # include +# include #elif defined HAVE_NCURSESW_H # include +# include #elif defined HAVE_NCURSES_CURSES_H # include +# include #elif defined HAVE_NCURSES_H # include +# include #elif defined HAVE_CURSES_H # include +# include #else # error "SysV or X/Open-compatible Curses header file required" #endif @@ -368,6 +373,7 @@ static void sigabrt(int sig) } if (lnav_log_orig_termios != NULL) { + endwin(); tcsetattr(STDOUT_FILENO, TCSAFLUSH, lnav_log_orig_termios); } fprintf(stderr, CRASH_MSG, crash_path); diff --git a/src/log_format_loader.cc b/src/log_format_loader.cc index 358989b0..46822a8a 100644 --- a/src/log_format_loader.cc +++ b/src/log_format_loader.cc @@ -595,6 +595,7 @@ struct json_path_handler format_handlers[] = { struct json_path_handler root_format_handler[] = { json_path_handler("/(?\\w+)/") + .with_description("The definition of a log file format.") .with_obj_provider(ensure_format) .with_children(format_handlers), diff --git a/test/Makefile.am b/test/Makefile.am index 56c283c1..47b51ff7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -54,6 +54,7 @@ AM_LDFLAGS = \ $(STATIC_LDFLAGS) \ $(SQLITE3_LDFLAGS) \ $(READLINE_LDFLAGS) \ + $(CURSES_LIB) \ -pthread CONFIG_OBJS = \ @@ -253,6 +254,7 @@ dist_noinst_DATA = \ bad-config/formats/no-samples/format.json \ bad-config-json/formats/invalid-json/format.json \ bad-config-json/formats/invalid-json/format2.json \ + bad-config-json/formats/invalid-key/format.json \ datafile_simple.0 \ datafile_simple.1 \ datafile_simple.2 \