summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-18 15:33:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-18 15:33:09 +0100
commit96c618d398082a01d9e704f9aeda241b901ff522 (patch)
treeebb09514506c68cf88ef4b9f9b39678b03e39041 /src
parent87be6ee96d2850a54d5d2a7dcf2b107e9d9f06af (diff)
downloadrspamd-96c618d398082a01d9e704f9aeda241b901ff522.tar.gz
rspamd-96c618d398082a01d9e704f9aeda241b901ff522.zip
Another fix for parse host/port.
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_utils.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 7b981d1dc..04e590105 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -113,20 +113,22 @@ parse_host_port_priority_strv (rspamd_mempool_t *pool, gchar **tokens,
}
}
if (priority != NULL) {
+ const gchar *tok;
+
if (port != NULL) {
- cur_tok = tokens[2];
+ tok = tokens[2];
}
else {
- cur_tok = tokens[1];
+ tok = tokens[1];
}
- if (cur_tok != NULL) {
+ if (tok != NULL) {
/* Priority part */
errno = 0;
- priority_parsed = strtoul (cur_tok, &err_str, 10);
+ priority_parsed = strtoul (tok, &err_str, 10);
if (*err_str != '\0' || errno != 0) {
msg_warn (
"cannot parse priority: %s, at symbol %c, error: %s",
- tokens[1],
+ tok,
*err_str,
strerror (errno));
}
@@ -144,7 +146,7 @@ parse_host_port_priority_strv (rspamd_mempool_t *pool, gchar **tokens,
cur_port = NULL;
}
- if ((r = getaddrinfo (tokens[0], cur_port, &hints, &res)) == 0) {
+ if ((r = getaddrinfo (cur_tok, cur_port, &hints, &res)) == 0) {
memcpy (&addr_holder, res->ai_addr,
MIN (sizeof (addr_holder), res->ai_addrlen));
if (res->ai_family == AF_INET) {