From 75300d10c232f3d93cb08585dff82811606299de Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 3 Aug 2006 22:03:18 +0000 Subject: [PATCH] don't drop characters that we've copied in when we block. --- sys/kern/tty_pty.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index eeb42931a80c..9c8300c40da3 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -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 -__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; }