summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/libuv/src/unix/stream.c
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/libuv/src/unix/stream.c')
-rw-r--r--3rdparty/libuv/src/unix/stream.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/3rdparty/libuv/src/unix/stream.c b/3rdparty/libuv/src/unix/stream.c
index 7d7ab2633b6..9043664dfca 100644
--- a/3rdparty/libuv/src/unix/stream.c
+++ b/3rdparty/libuv/src/unix/stream.c
@@ -946,13 +946,14 @@ static void uv__write_callbacks(uv_stream_t* stream) {
uv_handle_type uv__handle_type(int fd) {
struct sockaddr_storage ss;
+ socklen_t sslen;
socklen_t len;
int type;
memset(&ss, 0, sizeof(ss));
- len = sizeof(ss);
+ sslen = sizeof(ss);
- if (getsockname(fd, (struct sockaddr*)&ss, &len))
+ if (getsockname(fd, (struct sockaddr*)&ss, &sslen))
return UV_UNKNOWN_HANDLE;
len = sizeof type;
@@ -961,6 +962,14 @@ uv_handle_type uv__handle_type(int fd) {
return UV_UNKNOWN_HANDLE;
if (type == SOCK_STREAM) {
+#if defined(_AIX)
+ /* on AIX the getsockname call returns an empty sa structure
+ * for sockets of type AF_UNIX. For all other types it will
+ * return a properly filled in structure.
+ */
+ if (sslen == 0)
+ return UV_NAMED_PIPE;
+#endif
switch (ss.ss_family) {
case AF_UNIX:
return UV_NAMED_PIPE;
@@ -1082,6 +1091,11 @@ static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) {
}
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wgnu-folding-constant"
+#endif
+
static void uv__read(uv_stream_t* stream) {
uv_buf_t buf;
ssize_t nread;
@@ -1187,6 +1201,10 @@ static void uv__read(uv_stream_t* stream) {
}
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
#undef UV__CMSG_FD_COUNT
#undef UV__CMSG_FD_SIZE