diff options
author | libuv upstream <libuv@googlegroups.com> | 2019-06-10 13:17:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-18 11:45:34 (GMT) |
commit | b4069b04ff63b327ff4881282200c3c73fded34d (patch) | |
tree | f1c97b98e2253ec8e4a9b75ee2f8f99426e9b2f6 /src/unix/stream.c | |
parent | 4fcb0d0213112bb2fdb04bb27e82543b93cfe41d (diff) | |
download | CMake-b4069b04ff63b327ff4881282200c3c73fded34d.zip CMake-b4069b04ff63b327ff4881282200c3c73fded34d.tar.gz CMake-b4069b04ff63b327ff4881282200c3c73fded34d.tar.bz2 |
libuv 2019-06-10 (ee24ce90)
Code extracted from:
https://github.com/libuv/libuv.git
at commit ee24ce900e5714c950b248da2bdd311b01c983be (v1.x).
Diffstat (limited to 'src/unix/stream.c')
-rw-r--r-- | src/unix/stream.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unix/stream.c b/src/unix/stream.c index a75ba15..17b06a3 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -745,13 +745,13 @@ static int uv__write_req_update(uv_stream_t* stream, buf = req->bufs + req->write_index; - while (n > 0) { + do { len = n < buf->len ? n : buf->len; buf->base += len; buf->len -= len; buf += (buf->len == 0); /* Advance to next buffer if this one is empty. */ n -= len; - } + } while (n > 0); req->write_index = buf - req->bufs; @@ -897,7 +897,7 @@ start: goto error; } - if (n > 0 && uv__write_req_update(stream, req, n)) { + if (n >= 0 && uv__write_req_update(stream, req, n)) { uv__write_req_finish(req); return; /* TODO(bnoordhuis) Start trying to write the next request. */ } @@ -1541,7 +1541,7 @@ int uv_try_write(uv_stream_t* stream, } if (written == 0 && req_size != 0) - return UV_EAGAIN; + return req.error < 0 ? req.error : UV_EAGAIN; else return written; } |