From 1254198cf5dd650b5b1423e75156f80340f9c870 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 10 Dec 2007 17:59:26 +0000 Subject: [PATCH] in main(), exit if initscr() fails git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_0_branch/nano@4198 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/nano.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fecd4092..de7fa5b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,6 +90,8 @@ CVS code - (DLR, found by Paul Goins) - Make sure the mark is always properly positioned after uncutting text with the mark on. (DLR) + main() + - Exit if initscr() fails. (DLR) - prompt.c: do_yesno_prompt() - Remove redundant check for NO_HELP's being FALSE. (DLR) diff --git a/src/nano.c b/src/nano.c index 6acbadae..045157ce 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2036,7 +2036,7 @@ int main(int argc, char **argv) free(backup_dir); backup_dir = backup_dir_cpy; } -#endif +#endif #ifndef DISABLE_JUSTIFY if (quotestr_cpy != NULL) { free(quotestr); @@ -2162,8 +2162,9 @@ int main(int argc, char **argv) /* Back up the old terminal settings so that they can be restored. */ tcgetattr(0, &oldterm); - /* Initialize curses mode. */ - initscr(); + /* Initialize curses mode. If this fails, get out. */ + if (initscr() == NULL) + exit(1); /* Set up the terminal state. */ terminal_init(); -- 2.39.5