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
This commit is contained in:
rwatson 2001-11-09 02:23:05 +00:00
parent b77568ce81
commit 9b2a87cb18

View File

@ -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);
}