unix: fix error check when closing process pipe fd

uv__close() does not set errno, it returns the error.  It also never
returns EINTR, it always maps it to EINPROGRESS.

PR-URL: https://github.com/libuv/libuv/pull/512
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Ben Noordhuis 2015-09-06 10:09:35 +02:00
parent daa466275e
commit e95960cc68

View File

@ -226,13 +226,14 @@ static int uv__process_open_stream(uv_stdio_container_t* container,
int pipefds[2],
int writable) {
int flags;
int err;
if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0)
return 0;
if (uv__close(pipefds[1]))
if (errno != EINTR && errno != EINPROGRESS)
abort();
err = uv__close(pipefds[1]);
if (err != 0 && err != -EINPROGRESS)
abort();
pipefds[1] = -1;
uv__nonblock(pipefds[0], 1);