diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-15 19:21:37 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-15 19:40:51 +0200 |
commit | 6d5e65f6454212cd400d0ebda34978a9f20cc26a (patch) | |
tree | 844cd4d517956481a0963598edf586ae454524a0 /src/resolve/resolved-dns-scope.c | |
parent | 8e8132c6b849a0aa34dbe8d97027beb50f71f1e3 (diff) | |
download | systemd-6d5e65f6454212cd400d0ebda34978a9f20cc26a.tar.gz |
tree-wide: add a single version of "static const int one = 1"
All over the place we define local variables for the various sockopts
that take a bool-like "int" value. Sometimes they are const, sometimes
static, sometimes both, sometimes neither.
Let's clean this up, introduce a common const variable "const_int_one"
(as well as one matching "const_int_zero") and use it everywhere, all
acorss the codebase.
Diffstat (limited to 'src/resolve/resolved-dns-scope.c')
-rw-r--r-- | src/resolve/resolved-dns-scope.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index 5ceb954410..57af95c41f 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -313,7 +313,6 @@ static int dns_scope_socket( _cleanup_close_ int fd = -1; union sockaddr_union sa; socklen_t salen; - static const int one = 1; int r, ifindex; assert(s); @@ -379,7 +378,7 @@ static int dns_scope_socket( return -errno; if (type == SOCK_STREAM) { - r = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)); + r = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &const_int_one, sizeof(const_int_one)); if (r < 0) return -errno; } @@ -402,11 +401,11 @@ static int dns_scope_socket( /* RFC 4795, section 2.5 requires the TTL to be set to 1 */ if (sa.sa.sa_family == AF_INET) { - r = setsockopt(fd, IPPROTO_IP, IP_TTL, &one, sizeof(one)); + r = setsockopt(fd, IPPROTO_IP, IP_TTL, &const_int_one, sizeof(const_int_one)); if (r < 0) return -errno; } else if (sa.sa.sa_family == AF_INET6) { - r = setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &one, sizeof(one)); + r = setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &const_int_one, sizeof(const_int_one)); if (r < 0) return -errno; } |