unix: reduce line count, return uv__set_sys_error

This commit is contained in:
Saúl Ibarra Corretgé 2013-02-21 10:01:27 +01:00 committed by Ben Noordhuis
parent 3f47a2da5c
commit 9a8db3c0cb

View File

@ -1193,16 +1193,12 @@ int uv_write2(uv_write_t* req,
stream->type == UV_TTY) &&
"uv_write (unix) does not yet support other types of streams");
if (uv__stream_fd(stream) < 0) {
uv__set_sys_error(stream->loop, EBADF);
return -1;
}
if (uv__stream_fd(stream) < 0)
return uv__set_sys_error(stream->loop, EBADF);
if (send_handle) {
if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) {
uv__set_sys_error(stream->loop, EOPNOTSUPP);
return -1;
}
if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc)
return uv__set_sys_error(stream->loop, EOPNOTSUPP);
if (uv__stream_fd(send_handle) < 0)
return uv__set_sys_error(stream->loop, EBADF);
}
@ -1270,10 +1266,8 @@ static int uv__read_start_common(uv_stream_t* stream,
assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE ||
stream->type == UV_TTY);
if (stream->flags & UV_CLOSING) {
uv__set_sys_error(stream->loop, EINVAL);
return -1;
}
if (stream->flags & UV_CLOSING)
return uv__set_sys_error(stream->loop, EINVAL);
/* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just
* expresses the desired state of the user.