diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2015-09-29 22:03:24 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2015-09-29 22:03:24 +0300 |
commit | 3fcf9ee5980319e25fa8d225ea3d46f67f503d5f (patch) | |
tree | 51d1fabed27a6c8f8d1055074a1f89a6bedbbae6 | |
parent | b23232fd086284a05de68fc5cf9c40d8557aad3c (diff) | |
download | dico-3fcf9ee5980319e25fa8d225ea3d46f67f503d5f.tar.gz dico-3fcf9ee5980319e25fa8d225ea3d46f67f503d5f.tar.bz2 |
Fix default port in dico client
* dico/connect.c (dict_connect): Select default port if url->port
is not set.
-rw-r--r-- | dico/connect.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dico/connect.c b/dico/connect.c index 6362dd8..b77cdc6 100644 --- a/dico/connect.c +++ b/dico/connect.c @@ -276,9 +276,9 @@ dict_connect(struct dict_connection **pconn, dico_url_t url) struct addrinfo hints, *res, *rp; dico_stream_t str; struct dict_connection *conn; + char const *port = url->port ? url->port : DICO_DICT_PORT_STR; - XDICO_DEBUG_F2(1, _("Connecting to %s:%s\n"), url->host, - url->port ? url->port : DICO_DICT_PORT_STR); + XDICO_DEBUG_F2(1, _("Connecting to %s:%s\n"), url->host, port); if (source_addr) { memset(&hints, 0, sizeof(hints)); @@ -310,7 +310,7 @@ dict_connect(struct dict_connection **pconn, dico_url_t url) memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; - rc = getaddrinfo(url->host, url->port, &hints, &res); + rc = getaddrinfo(url->host, port, &hints, &res); for (rp = res; rp; rp = rp->ai_next) { if (fd != -1 && family != rp->ai_family) { close(fd); |