diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2015-02-20 02:13:03 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2015-02-20 03:35:11 +0100 |
commit | 02233928a502e46fc125118dba7234ba3e48dc15 (patch) | |
tree | 1ae42711ffc1e9f25178b3b269880582f289665f /src | |
parent | dbafedacba3ee77098e932222ae7840e7b4040fc (diff) |
shared: avoid semi-duplicating socket_address_equal()
Just call socket_address_equal() from socket_address_matches_fd()
instead of implementing similar comparing of addresses.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/socket-util.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c index c31f60ec7e..deecce8a80 100644 --- a/src/shared/socket-util.c +++ b/src/shared/socket-util.c @@ -464,23 +464,7 @@ bool socket_address_matches_fd(const SocketAddress *a, int fd) { return false; } - switch (b.sockaddr.sa.sa_family) { - - case AF_INET: - return b.sockaddr.in.sin_port == a->sockaddr.in.sin_port && - b.sockaddr.in.sin_addr.s_addr == a->sockaddr.in.sin_addr.s_addr; - - case AF_INET6: - return b.sockaddr.in6.sin6_port == a->sockaddr.in6.sin6_port && - memcmp(&b.sockaddr.in6.sin6_addr, &a->sockaddr.in6.sin6_addr, sizeof(struct in6_addr)) == 0; - - case AF_UNIX: - return b.sockaddr.size == a->size && - memcmp(b.sockaddr.un.sun_path, a->sockaddr.un.sun_path, b.size - offsetof(struct sockaddr_un, sun_path)) == 0; - - } - - return false; + return socket_address_equal(a, &b); } int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, char **ret) { |