From 03e6d8e02a187633a6a09c77e36670f0892d063d Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Thu, 2 Jun 2016 08:44:59 +0200 Subject: AF_UNIX is more portable Fix dialyzer warning for improper list in prim_inet by not using an improper list. --- erts/emulator/drivers/common/inet_drv.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 71e321df26..46adbb09f7 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -3639,7 +3639,7 @@ static int tcp_error_message(tcp_descriptor* desc, int err) ** {sctp, S, IP, Port, {[AncilData], Event_or_Data}} ** where ** [H1,...,HSz] are msg headers (without IP/Port, UDP only), -** [AddrLen, H2,...,HSz] are msg headers for UDP AF_LOCAL only +** [AddrLen, H2,...,HSz] are msg headers for UDP AF_UNIX only ** Data : List() | Binary() */ static int packet_binary_message @@ -4217,7 +4217,7 @@ static char* inet_set_address(int family, inet_address* dst, } #endif #ifdef HAVE_SYS_UN_H - else if ((family == AF_LOCAL) && (*len >= 1)) { + else if ((family == AF_UNIX) && (*len >= 1)) { int n = *((unsigned char*)src); if ((*len < 1+n) || (sizeof(dst->sal.sun_path) < n+1)) return NULL; @@ -4256,7 +4256,7 @@ static char *inet_set_faddress(int family, inet_address* dst, # endif # ifdef HAVE_SYS_UN_H case INET_AF_LOCAL: { - family = AF_LOCAL; + family = AF_UNIX; break; } # endif @@ -4357,7 +4357,7 @@ static int inet_get_address(char* dst, inet_address* src, unsigned int* len) } #endif #ifdef HAVE_SYS_UN_H - else if (family == AF_LOCAL) { + else if (family == AF_UNIX) { size_t n, m; if (*len < offsetof(struct sockaddr_un, sun_path)) return -1; n = *len - offsetof(struct sockaddr_un, sun_path); @@ -4418,7 +4418,7 @@ inet_address_to_erlang(char *dst, inet_address **src, SOCKLEN_T sz) { return 1 + 2 + 16; #endif #ifdef HAVE_SYS_UN_H - case AF_LOCAL: { + case AF_UNIX: { size_t n, m; if (sz < offsetof(struct sockaddr_un, sun_path)) return -1; n = sz - offsetof(struct sockaddr_un, sun_path); @@ -4461,8 +4461,8 @@ static ErlDrvSizeT reply_inet_addrs * of addrs[0] from e.g getsockname() and then n == 1 * so we will loop over 1 element below. Otherwise sz * would be expected to differ between addresses but that - * can only happen for AF_LOCAL and we will only be called with - * n > 1 for SCTP and that will never (?) happen with AF_LOCAL + * can only happen for AF_UNIX and we will only be called with + * n > 1 for SCTP and that will never (?) happen with AF_UNIX */ /* Calculate result length */ @@ -4662,7 +4662,7 @@ static ErlDrvSSizeT inet_ctl_open(inet_descriptor* desc, int domain, int type, #endif protocol = desc->sprotocol; #ifdef HAVE_SYS_UN_H - if (domain == AF_LOCAL) protocol = 0; + if (domain == AF_UNIX) protocol = 0; #endif if ((desc->s = sock_open(domain, type, protocol)) == INVALID_SOCKET) save_errno = sock_errno(); @@ -8719,7 +8719,7 @@ static ErlDrvSSizeT inet_ctl(inet_descriptor* desc, int cmd, char* buf, } #endif #ifdef HAVE_SYS_UN_H - else if (desc->sfamily == AF_LOCAL) { + else if (desc->sfamily == AF_UNIX) { put_int32(INET_AF_LOCAL, &tbuf[0]); } #endif @@ -9424,7 +9424,7 @@ static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd, #endif #ifdef HAVE_SYS_UN_H case INET_AF_LOCAL: - domain = AF_LOCAL; + domain = AF_UNIX; break; #endif default: @@ -9455,7 +9455,7 @@ static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd, #endif #ifdef HAVE_SYS_UN_H case INET_AF_LOCAL: - domain = AF_LOCAL; + domain = AF_UNIX; break; #endif default: @@ -11521,7 +11521,7 @@ static ErlDrvSSizeT packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, break; #endif #ifdef HAVE_SYS_UN_H - case INET_AF_LOCAL: af = AF_LOCAL; break; + case INET_AF_LOCAL: af = AF_UNIX; break; #endif default: return ctl_error(EINVAL, rbuf, rsize); @@ -11574,7 +11574,7 @@ static ErlDrvSSizeT packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, break; #endif #ifdef HAVE_SYS_UN_H - case INET_AF_LOCAL: af = AF_LOCAL; break; + case INET_AF_LOCAL: af = AF_UNIX; break; #endif default: return ctl_error(EINVAL, rbuf, rsize); -- cgit v1.2.3