On Mon, Dec 06, 2004 at 02:45:10AM +0100, Bas van Gompel wrote:
>Hi,
>
>A real bugfix this time.
>
>When fhandler_base::puts_readahead is given a (non -1) len-parameter,
>in the current implementation, not len characters are stowed, but len
>z-strings. This affects at least fhandler_pty_master::accept_input in
>fhandler_tty.cc.
>
>Following (trivial, I'd say) patch ought to fix it.
>
>
>ChangeLog-entry:
>
>2004-12-06 Bas van Gompel  <[EMAIL PROTECTED]>
>
>       * fhandler.cc (fhandler_base::puts_readahead): Fix end-condition.

This patch changes things so that len characters are always output if
len is != -1.  It has been a while since I worked on this code but it's
not clear that that is correct.

cgf

>--- src/winsup/cygwin-mmod/fhandler.cc 5 Dec 2004 07:28:27 -0000       1.209
>+++ src/winsup/cygwin-mmod/fhandler.cc 6 Dec 2004 01:14:14 -0000
>@@ -54,7 +54,7 @@ int
> fhandler_base::puts_readahead (const char *s, size_t len)
> {
>   int success = 1;
>-  while ((*s || (len != (size_t) -1 && len--))
>+  while ((len == (size_t) -1 ? *s : len--)
>        && (success = put_readahead (*s++) > 0))
>     continue;
>   return success;

Reply via email to