diff --git a/src/unix/process.c b/src/unix/process.c index 934175a9..aab8cdea 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -190,7 +190,7 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) { int fd; int ret; int size = 64 * 1024; - int options[] = {SO_RCVBUF, SO_SNDBUF}; + int i; mask = UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM; @@ -205,18 +205,11 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) { else { ret = uv_socketpair(SOCK_STREAM, 0, fds, 0, 0); -#ifdef __APPLE__ - if (ret == 0) { - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - ret = setsockopt(fds[i], SOL_SOCKET, options[j], &size, sizeof(size)); - - if (ret != 0) - return ret; - } + if (ret == 0) + for (i = 0; i < 2; i++) { + setsockopt(fds[i], SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); + setsockopt(fds[i], SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); } - } -#endif return ret; } diff --git a/test/test-spawn.c b/test/test-spawn.c index da459556..0d7924be 100644 --- a/test/test-spawn.c +++ b/test/test-spawn.c @@ -603,7 +603,6 @@ TEST_IMPL(spawn_stdin) { r = uv_spawn(uv_default_loop(), &process, &options); ASSERT_OK(r); -#ifdef __APPLE__ int recv_buf; int recv_fd; int send_buf; @@ -618,7 +617,6 @@ TEST_IMPL(spawn_stdin) { ASSERT_OK(uv_fileno((uv_handle_t*) options.stdio[1].data.stream, &send_fd)); ASSERT_OK(getsockopt(send_fd, SOL_SOCKET, SO_SNDBUF, &send_buf, &optlen)); ASSERT_EQ(send_buf, size); -#endif buf.base = buffer; buf.len = sizeof(buffer);