diff options
Diffstat (limited to 'servport.c')
-rw-r--r-- | servport.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,6 +1,6 @@ /** \file servport.c Resolve service name to port number. * \author Matthias Andree - * \date 2005 + * \date 2005 - 2006 * * Copyright (C) 2005 by Matthias Andree * For license terms, see the file COPYING in this directory. @@ -47,6 +47,7 @@ int servport(const char *service) { memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; e = getaddrinfo(NULL, service, &hints, &res); if (e) { report(stderr, GT_("getaddrinfo(NULL, \"%s\") error: %s\n"), @@ -63,6 +64,7 @@ int servport(const char *service) { break; #endif default: + freeaddrinfo(res); goto err; } freeaddrinfo(res); |