Code

os utils: Fixed a typo in the UDP resolver implementation.
authorSebastian Harl <sh@tokkee.org>
Wed, 14 Jan 2015 21:02:31 +0000 (22:02 +0100)
committerSebastian Harl <sh@tokkee.org>
Wed, 14 Jan 2015 21:02:31 +0000 (22:02 +0100)
src/utils/os.c

index d8f707418b9cadb57040ef20473e6ee7d9b1de7d..4afc466683138aed81667a446638698bbe96da91 100644 (file)
@@ -286,6 +286,7 @@ sdb_resolve(int network, const char *address, struct addrinfo **res)
                ai_hints.ai_family = AF_INET6;
        else
                ai_hints.ai_family = AF_UNSPEC;
                ai_hints.ai_family = AF_INET6;
        else
                ai_hints.ai_family = AF_UNSPEC;
+
        if ((network & SDB_NET_IP) == SDB_NET_IP) {
                ai_hints.ai_socktype = 0;
                ai_hints.ai_protocol = 0;
        if ((network & SDB_NET_IP) == SDB_NET_IP) {
                ai_hints.ai_socktype = 0;
                ai_hints.ai_protocol = 0;
@@ -296,7 +297,7 @@ sdb_resolve(int network, const char *address, struct addrinfo **res)
        }
        else if (network & SDB_NET_UDP) {
                ai_hints.ai_socktype = SOCK_DGRAM;
        }
        else if (network & SDB_NET_UDP) {
                ai_hints.ai_socktype = SOCK_DGRAM;
-               ai_hints.ai_socktype = IPPROTO_UDP;
+               ai_hints.ai_protocol = IPPROTO_UDP;
        }
 
        status = getaddrinfo(host, port, &ai_hints, res);
        }
 
        status = getaddrinfo(host, port, &ai_hints, res);