summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2015-09-29 19:03:24 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2015-09-29 19:03:24 (GMT)
commit3fcf9ee5980319e25fa8d225ea3d46f67f503d5f (patch) (side-by-side diff)
tree51d1fabed27a6c8f8d1055074a1f89a6bedbbae6
parentb23232fd086284a05de68fc5cf9c40d8557aad3c (diff)
downloaddico-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--dico/connect.c6
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);

Return to:

Send suggestions and report system problems to the System administrator.