Merge pull request #7745 from poettering/sockaddr-size

mostly systemd-analyze fixes
This commit is contained in:
Yu Watanabe
2017-12-29 23:13:53 +09:00
committed by GitHub
4 changed files with 134 additions and 132 deletions
+5 -9
View File
@@ -306,17 +306,13 @@ _public_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint
return 0;
if (port > 0) {
if (sockaddr.sa.sa_family == AF_INET) {
if (l < sizeof(struct sockaddr_in))
return -EINVAL;
unsigned sa_port;
return htobe16(port) == sockaddr.in.sin_port;
} else {
if (l < sizeof(struct sockaddr_in6))
return -EINVAL;
r = sockaddr_port(&sockaddr.sa, &sa_port);
if (r < 0)
return r;
return htobe16(port) == sockaddr.in6.sin6_port;
}
return port == sa_port;
}
return 1;