From 524e0aa174224641bc6807ec112e46f98e27cfe0 Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 11 May 2006 21:58:46 +1000 Subject: [PATCH] Add fallback del_curterm which does nothing, used in preference to BSD curses del_curterm, which seems to do a double-free darcs-hash:20060511115846-ac50b-8d5fc054d31cff637d30e858ae8ffe2b1d1e8c03.gz --- configure.ac | 14 ++++++++++++++ fallback.c | 8 ++++++++ fallback.h | 8 ++++++++ 3 files changed, 30 insertions(+) diff --git a/configure.ac b/configure.ac index 6fd53c511..706a69bcf 100644 --- a/configure.ac +++ b/configure.ac @@ -389,6 +389,20 @@ else AC_MSG_RESULT(no) fi +# Check if we are using basic BSD curses - in that case we redefine +# del_curterm as a no-op, to avoid a double-free + +AC_MSG_CHECKING([If we are using BSD curses]) +case $target_os in + *bsd*) + AC_MSG_RESULT(yes) + AC_CHECK_LIB( ncurses, del_curterm, true, [AC_DEFINE([HAVE_BROKEN_DEL_CURTERM],[1],[We are using basic BSD curses, redefine del_curterm to a no-op to avoid a double-free bug])]) + ;; + *) + AC_MSG_RESULT(no) + ;; +esac + # Tell the world what we know AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish share/fish seq]) AC_OUTPUT diff --git a/fallback.c b/fallback.c index d98eb0360..3024ae2c6 100644 --- a/fallback.c +++ b/fallback.c @@ -997,3 +997,11 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) #endif +#ifdef HAVE_BROKEN_DEL_CURTERM + +int del_curterm(TERMINAL *oterm) +{ +} + +#endif + diff --git a/fallback.h b/fallback.h index e3952ec3a..10a071213 100644 --- a/fallback.h +++ b/fallback.h @@ -271,4 +271,12 @@ size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz ); #endif +#ifdef HAVE_BROKEN_DEL_CURTERM + +/** + BSD del_curterm seems to do a double-free. We redefine it as a no-op +*/ +int del_curterm(TERMINAL *oterm); +#endif + #endif