From d6b401e5d3cb3e101f7b23455d77baa648b6157a Mon Sep 17 00:00:00 2001 From: Kevin Harwell <kharwell@digium.com> Date: Mon, 21 Oct 2013 19:50:28 +0000 Subject: [PATCH] Segfault in LIBEDIT_INTERNAL after tgetstr(), when libncurses5-dev isn't installed Include the appropriate declarations when not using termcap, but term+curses and [n]curses do not exist. (closes issue ASTERISK-22351) Reported by: A. Iglesias Patches: issueA22351_libedit_internal_without_ncurses_dev.patch uploaded by wdoekes (license 5674) ........ Merged revisions 401325 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401326 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401327 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401328 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/editline/term.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/editline/term.c b/main/editline/term.c index 63cec6e43e..00b68ed339 100644 --- a/main/editline/term.c +++ b/main/editline/term.c @@ -65,15 +65,17 @@ __RCSID("$NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $"); #include <ncurses.h> #endif #if defined(HAVE_TERM_H) -#include "term.h" /* Can not use /usr/include/term.h because of a lot of incompatibilities, so just define some prototypes */ +#include "term.h" +#endif /* defined(HAVE_TERM_H) */ +#if defined(HAVE_TERM_H) || !(defined(HAVE_TERMCAP_H) || defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H)) extern int tgetent(char *, const char *); extern int tgetflag(const char *); extern int tgetnum(const char *); extern char *tgetstr(const char *, char **); extern int tputs (const char *, int, int (*)(int)); extern char *tgoto (const char *, int, int); -#endif /* defined(HAVE_TERM_H) */ +#endif /* defined(HAVE_TERM_H) or none_of_the_others */ #include <sys/types.h> #include <sys/ioctl.h> -- GitLab