From e68748a6eea7cd8190f4780f7bfd39bf9d455923 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/trunk/nano@4198 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/nano.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 439a3095..f5cc9860 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-12-10 David Lawrence Ramsey + + * nano.c (main): Exit if initscr() fails. + 2007-12-09 David Lawrence Ramsey * faq.html: Add minor punctuation and wording fixes, and update diff --git a/src/nano.c b/src/nano.c index 483ee449..37a78dff 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2038,7 +2038,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); @@ -2164,8 +2164,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