summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/unix/pipe.c')
-rw-r--r--deps/uv/src/unix/pipe.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 7f87a713bf..d4fdfa9d5a 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -200,9 +200,6 @@ out:
if (err)
uv__io_feed(handle->loop, &handle->io_watcher);
- /* Mimic the Windows pipe implementation, always
- * return 0 and let the callback handle errors.
- */
}
@@ -234,14 +231,18 @@ static int uv__pipe_getsockpeername(const uv_pipe_t* handle,
addrlen = strlen(sa.sun_path);
- if (addrlen > *size) {
- *size = addrlen;
+ if (addrlen >= *size) {
+ *size = addrlen + 1;
return UV_ENOBUFS;
}
memcpy(buffer, sa.sun_path, addrlen);
*size = addrlen;
+ /* only null-terminate if it's not an abstract socket */
+ if (buffer[0] != '\0')
+ buffer[addrlen] = '\0';
+
return 0;
}