summaryrefslogtreecommitdiffstats
path: root/lib/libcurses/base/lib_set_term.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2000-06-19 03:53:34 +0000
committermillert <millert@openbsd.org>2000-06-19 03:53:34 +0000
commit1fe33145a0a9b1310a0413297a8deb871918b27f (patch)
treea49980b8f48836a617da8010fb9ef237771dbe5b /lib/libcurses/base/lib_set_term.c
parentIPv6 IPsec, outbound direction. (diff)
downloadwireguard-openbsd-1fe33145a0a9b1310a0413297a8deb871918b27f.tar.xz
wireguard-openbsd-1fe33145a0a9b1310a0413297a8deb871918b27f.zip
ncurses-5.0-20000617
Diffstat (limited to 'lib/libcurses/base/lib_set_term.c')
-rw-r--r--lib/libcurses/base/lib_set_term.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c
index 014e43a85f3..1faa7d53fd1 100644
--- a/lib/libcurses/base/lib_set_term.c
+++ b/lib/libcurses/base/lib_set_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_set_term.c,v 1.8 2000/03/26 16:45:03 millert Exp $ */
+/* $OpenBSD: lib_set_term.c,v 1.9 2000/06/19 03:53:46 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -45,7 +45,7 @@
#include <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$From: lib_set_term.c,v 1.51 2000/03/26 01:03:36 tom Exp $")
+MODULE_ID("$From: lib_set_term.c,v 1.52 2000/05/27 23:22:36 tom Exp $");
SCREEN *
set_term(SCREEN * screenp)
@@ -111,6 +111,18 @@ delscreen(SCREEN * sp)
del_curterm(sp->_term);
+ /*
+ * If the associated output stream has been closed, we can discard the
+ * set-buffer. Limit the error check to EBADF, since fflush may fail
+ * for other reasons than trying to operate upon a closed stream.
+ */
+ if (sp->_ofp != 0
+ && sp->_setbuf != 0
+ && fflush(sp->_ofp) != 0
+ && errno == EBADF) {
+ free(sp->_setbuf);
+ }
+
free(sp);
/*