Merge pull request #13005 from keszybz/fix-gcc-warning

Fix two gcc warnings
This commit is contained in:
Lennart Poettering
2019-07-10 16:20:31 +02:00
committed by GitHub
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -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;
+3 -2
View File
@@ -5,6 +5,7 @@
#include "dm-util.h"
#include "fd-util.h"
#include "string-util.h"
int dm_deferred_remove(const char *name) {
@@ -25,14 +26,14 @@ int dm_deferred_remove(const char *name) {
/* Unfortunately, libcryptsetup doesn't provide a proper API for this, hence call the ioctl()
* directly. */
if (strlen(name) > sizeof(dm.name)-1)
if (strlen(name) >= sizeof(dm.name))
return -ENODEV; /* A device with a name longer than this cannot possibly exist */
fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC);
if (fd < 0)
return -errno;
strncpy(dm.name, name, sizeof(dm.name));
strncpy_exact(dm.name, name, sizeof(dm.name));
if (ioctl(fd, DM_DEV_REMOVE, &dm))
return -errno;