don't drop characters that we've copied in when we block.

This commit is contained in:
christos 2006-08-03 22:03:18 +00:00
parent 9410ca204b
commit 75300d10c2

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty_pty.c,v 1.91 2006/07/23 22:06:11 ad Exp $ */
/* $NetBSD: tty_pty.c,v 1.92 2006/08/03 22:03:18 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.91 2006/07/23 22:06:11 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.92 2006/08/03 22:03:18 christos Exp $");
#include "opt_compat_sunos.h"
#include "opt_ptm.h"
@ -753,6 +753,7 @@ again:
TTY_LOCK(tp);
/* check again for safety */
if (!ISSET(tp->t_state, TS_ISOPEN)) {
uip->
error = EIO;
goto out;
}
@ -780,6 +781,8 @@ again:
TTY_LOCK(tp);
/* check again for safety */
if (!ISSET(tp->t_state, TS_ISOPEN)) {
/* adjust for data copied in but not written */
uio->uio_resid += cc;
error = EIO;
goto out;
}
@ -812,6 +815,8 @@ block:
* in outq, or space in rawq.
*/
if (!ISSET(tp->t_state, TS_CARR_ON)) {
/* adjust for data copied in but not written */
uio->uio_resid += cc;
error = EIO;
goto out;
}