summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-18 21:44:34 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-18 21:44:34 -0400
commit901fd8164797f3eeb9921c85915dc409d49ab5d8 (patch)
treee5bf74b336daefeb1be2f00a90e88c00fd9a06e9 /src
parent7566e26721ee95d6fc864e9e6654fb61bd3cd603 (diff)
resolved: do not use unitialized variable
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-scope.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index e74fcd4491..190c5f41af 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -182,7 +182,7 @@ int dns_scope_tcp_socket(DnsScope *s) {
_cleanup_close_ int fd = -1;
union sockaddr_union sa = {};
socklen_t salen;
- int one, ifindex, ret;
+ int one, ret;
DnsServer *srv;
int r;
@@ -192,9 +192,6 @@ int dns_scope_tcp_socket(DnsScope *s) {
if (!srv)
return -ESRCH;
- if (s->link)
- ifindex = s->link->ifindex;
-
sa.sa.sa_family = srv->family;
if (srv->family == AF_INET) {
sa.in.sin_port = htobe16(53);
@@ -203,7 +200,7 @@ int dns_scope_tcp_socket(DnsScope *s) {
} else if (srv->family == AF_INET6) {
sa.in6.sin6_port = htobe16(53);
sa.in6.sin6_addr = srv->address.in6;
- sa.in6.sin6_scope_id = ifindex;
+ sa.in6.sin6_scope_id = s->link ? s->link->ifindex : 0;
salen = sizeof(sa.in6);
} else
return -EAFNOSUPPORT;