summaryrefslogtreecommitdiffstats
path: root/contrib/nvi
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-11-09 02:23:05 +0000
committerrwatson <rwatson@FreeBSD.org>2001-11-09 02:23:05 +0000
commit9b2a87cb189d461265c53d6579db7279c9eb23bc (patch)
treebeb12235109625bebcdde740f8d31fafc6d80ac4 /contrib/nvi
parentb77568ce81b74acf7927ee3ec4c67274ee99608f (diff)
downloadFreeBSD-src-9b2a87cb189d461265c53d6579db7279c9eb23bc.zip
FreeBSD-src-9b2a87cb189d461265c53d6579db7279c9eb23bc.tar.gz
o nvi failed to correctly handle EINTR returned from tcsetattr(), exiting
instead of recovering, which happens in particular during a rapid series of SIGWINCH's. This change forces nvi to loop on the call in the event that the call is interrupted. Interestingly, I submitted this bug report in 1998, and a solution was posted shortly thereafter by Matthias Buelow; it's been sitting in the PR database ever since. Note: this takes this file off the vendor branch. If and when we find a vendor for this code, the fix should be given back to them. PR: bin/8438 Submitted by: Matthias Buelow <mkb@altair.mayn.de> MFC after: 1 month
Diffstat (limited to 'contrib/nvi')
-rw-r--r--contrib/nvi/cl/cl_screen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/nvi/cl/cl_screen.c b/contrib/nvi/cl/cl_screen.c
index 2ce58e8..7f28aaa 100644
--- a/contrib/nvi/cl/cl_screen.c
+++ b/contrib/nvi/cl/cl_screen.c
@@ -5,6 +5,8 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
+ *
+ * $FreeBSD$
*/
#include "config.h"
@@ -368,6 +370,8 @@ cl_vi_init(sp)
fast: /* Set the terminal modes. */
if (tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &clp->vi_enter)) {
+ if (errno == EINTR)
+ goto fast;
msgq(sp, M_SYSERR, "tcsetattr");
err: (void)cl_vi_end(sp->gp);
return (1);
@@ -486,6 +490,8 @@ cl_ex_init(sp)
#endif
fast: if (tcsetattr(STDIN_FILENO, TCSADRAIN | TCSASOFT, &clp->ex_enter)) {
+ if (errno == EINTR)
+ goto fast;
msgq(sp, M_SYSERR, "tcsetattr");
return (1);
}
OpenPOWER on IntegriCloud