diff options
author | isaacs <i@izs.me> | 2012-07-19 09:29:29 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-07-19 09:33:02 -0700 |
commit | 0c91b0e48e0358cea2e52857275ca5880bf47a54 (patch) | |
tree | 0397adf479dd7de602e1acff39be5a4dbba0627e /deps/uv/src/unix/pipe.c | |
parent | b2648934f013ccdf1a15bb74a5480d5a42a97943 (diff) | |
download | android-node-v8-0c91b0e48e0358cea2e52857275ca5880bf47a54.tar.gz android-node-v8-0c91b0e48e0358cea2e52857275ca5880bf47a54.tar.bz2 android-node-v8-0c91b0e48e0358cea2e52857275ca5880bf47a54.zip |
uv: Upgrade to 94355e4
Diffstat (limited to 'deps/uv/src/unix/pipe.c')
-rw-r--r-- | deps/uv/src/unix/pipe.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c index 317ac67c10..957e96f8a6 100644 --- a/deps/uv/src/unix/pipe.c +++ b/deps/uv/src/unix/pipe.c @@ -170,18 +170,17 @@ void uv_pipe_connect(uv_connect_t* req, uv_connect_cb cb) { struct sockaddr_un saddr; int saved_errno; - int sockfd; - int status; + int new_sock; + int err; int r; saved_errno = errno; - sockfd = -1; - status = -1; + new_sock = (handle->fd == -1); + err = -1; - if ((sockfd = uv__socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { - uv__set_sys_error(handle->loop, errno); - goto out; - } + if (new_sock) + if ((handle->fd = uv__socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + goto out; memset(&saddr, 0, sizeof saddr); uv_strlcpy(saddr.sun_path, name, sizeof(saddr.sun_path)); @@ -191,25 +190,25 @@ void uv_pipe_connect(uv_connect_t* req, * is either there or not. */ do { - r = connect(sockfd, (struct sockaddr*)&saddr, sizeof saddr); + r = connect(handle->fd, (struct sockaddr*)&saddr, sizeof saddr); } while (r == -1 && errno == EINTR); - if (r == -1) { - status = errno; - close(sockfd); + if (r == -1) goto out; - } - uv__stream_open((uv_stream_t*)handle, - sockfd, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); + if (new_sock) + if (uv__stream_open((uv_stream_t*)handle, + handle->fd, + UV_STREAM_READABLE | UV_STREAM_WRITABLE)) + goto out; + uv__io_start(handle->loop, &handle->read_watcher); uv__io_start(handle->loop, &handle->write_watcher); - status = 0; + err = 0; out: - handle->delayed_error = status; /* Passed to callback. */ + handle->delayed_error = err ? errno : 0; /* Passed to callback. */ handle->connect_req = req; uv__req_init(handle->loop, req, UV_CONNECT); |