Index: tty_pts.c =================================================================== --- tty_pts.c (revision 195892) +++ tty_pts.c (working copy) @@ -204,8 +204,10 @@ error = uiomove(ib, iblen, uio); tty_lock(tp); - if (error != 0) + if (error != 0) { + iblen = 0; goto done; + } /* * When possible, avoid the slow path. rint_bypass() @@ -260,6 +262,12 @@ done: ttydisc_rint_done(tp); tty_unlock(tp); + + /* + * Don't account for the part of the buffer that we couldn't + * pass to the TTY. + */ + uio->uio_resid += iblen; return (error); } Index: tty_ttydisc.c =================================================================== --- tty_ttydisc.c (revision 195892) +++ tty_ttydisc.c (working copy) @@ -1060,6 +1060,8 @@ ret = ttyinq_write(&tp->t_inq, buf, len, 0); ttyinq_canonicalize(&tp->t_inq); + if (ret < len) + tty_hiwat_in_block(tp); return (ret); }