summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-10 10:30:12 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-10 10:32:39 +0200
commit573e9a3310ec99c34cee8a45a860ae353ac5994c (patch)
tree779648753dafc2ba2d0320fc5144576c5329ae4e /src/network/networkd-link.c
parentshared/dm-util: use strncpy_exact() to silence gcc (diff)
downloadsystemd-573e9a3310ec99c34cee8a45a860ae353ac5994c.tar.xz
systemd-573e9a3310ec99c34cee8a45a860ae353ac5994c.zip
networkd: silence bogus gcc warning about %s
Fixes #12931. In file included from ../src/basic/macro.h:558, from ../src/basic/alloc-util.h:9, from ../src/network/networkd-link.c:7: ../src/network/networkd-link.c: In function ‘link_sysctl_ipv6_enabled’: ../src/basic/log.h:107:9: error: ‘%s’ directive argument is null [-Werror=format-overflow=] 107 | log_internal_realm(LOG_REALM_PLUS_LEVEL(LOG_REALM, (level)), __VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/shared/log-link.h:21:25: note: in expansion of macro ‘log_internal’ 21 | log_internal(level, error, _FILE_, __LINE__, __func__, ##__VA_ARGS__); \ | ^~~~~~~~~~~~ ../src/shared/log-link.h:33:50: note: in expansion of macro ‘log_link_full’ 33 | #define log_link_warning_errno(link, error, ...) log_link_full(link, LOG_WARNING, error, ##__VA_ARGS__) | ^~~~~~~~~~~~~ ../src/network/networkd-link.c:83:24: note: in expansion of macro ‘log_link_warning_errno’ 83 | return log_link_warning_errno(link, r, | ^~~~~~~~~~~~~~~~~~~~~~ ../src/network/networkd-link.c:84:77: note: format string is defined here 84 | "Failed to read net.ipv6.conf.%s.disable_ipv6 sysctl property: %m", | ^~ cc1: some warnings being treated as errors
Diffstat (limited to '')
-rw-r--r--src/network/networkd-link.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 5f91d66dc0..f45d881cf8 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -78,11 +78,12 @@ int link_sysctl_ipv6_enabled(Link *link) {
if (link->sysctl_ipv6_enabled >= 0)
return link->sysctl_ipv6_enabled;
- r = sysctl_read_ip_property(AF_INET6, link->ifname, "disable_ipv6", &value);
+ const char *ifname = link->ifname; /* work around bogus gcc warning */
+ r = sysctl_read_ip_property(AF_INET6, ifname, "disable_ipv6", &value);
if (r < 0)
return log_link_warning_errno(link, r,
"Failed to read net.ipv6.conf.%s.disable_ipv6 sysctl property: %m",
- link->ifname);
+ ifname);
link->sysctl_ipv6_enabled = value[0] == '0';
return link->sysctl_ipv6_enabled;