aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2016-06-02 08:44:59 +0200
committerRaimo Niskanen <[email protected]>2016-06-02 08:44:59 +0200
commit03e6d8e02a187633a6a09c77e36670f0892d063d (patch)
tree627d1cca102a8a4d82f5d93bbd3639027361a593
parent0f1a85ef0373f2b5767579a30a6dc29eeb16438a (diff)
downloadotp-03e6d8e02a187633a6a09c77e36670f0892d063d.tar.gz
otp-03e6d8e02a187633a6a09c77e36670f0892d063d.tar.bz2
otp-03e6d8e02a187633a6a09c77e36670f0892d063d.zip
AF_UNIX is more portable
Fix dialyzer warning for improper list in prim_inet by not using an improper list.
-rw-r--r--erts/emulator/drivers/common/inet_drv.c26
-rw-r--r--erts/preloaded/src/prim_inet.erl2
2 files changed, 14 insertions, 14 deletions
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);
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl
index c6434fd83b..71dbfbd0a7 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -1756,7 +1756,7 @@ enc_value_2(addr, {local,Addr}) ->
unicode:characters_to_binary(
Addr, file:native_name_encoding())
end,
- [?INET_AF_LOCAL,byte_size(Bin)|Bin];
+ [?INET_AF_LOCAL,byte_size(Bin),Bin];
%%
enc_value_2(ether, [_,_,_,_,_,_]=Xs) -> Xs;
enc_value_2(sockaddr, any) ->