win, tty: remove zero-size read callbacks

In some situations console read callback would return 0 bytes read.
According to documentation this means EAGAIN or EWOULDBLOCK, which is
not the case in any of the situations that currently happen.

This removes those zero-size callbacks.

Fixes: https://github.com/libuv/libuv/issues/2012
PR-URL: https://github.com/libuv/libuv/pull/2014
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Bartosz Sosnowski 2018-10-23 16:18:34 +02:00
parent 1dfa88f35b
commit b901e2620c

View File

@ -941,20 +941,15 @@ void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle,
handle->read_cb((uv_stream_t*) handle,
uv_translate_sys_error(GET_REQ_ERROR(req)),
&buf);
} else {
/* The read was cancelled, or whatever we don't care */
handle->read_cb((uv_stream_t*) handle, 0, &buf);
}
} else {
if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING)) {
if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING) &&
req->u.io.overlapped.InternalHigh != 0) {
/* Read successful. TODO: read unicode, convert to utf-8 */
DWORD bytes = req->u.io.overlapped.InternalHigh;
handle->read_cb((uv_stream_t*) handle, bytes, &buf);
} else {
handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING;
handle->read_cb((uv_stream_t*) handle, 0, &buf);
}
handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING;
}
/* Wait for more input events. */