mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
netdev: do not assign unused values
This commit is contained in:
parent
aa2cc005d7
commit
ad16158c10
@ -64,8 +64,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
|
||||
if (fd < 0)
|
||||
return log_netdev_error_errno(netdev, -errno, "Failed to open tun dev: %m");
|
||||
|
||||
r = ioctl(fd, TUNSETIFF, ifr);
|
||||
if (r < 0)
|
||||
if (ioctl(fd, TUNSETIFF, ifr) < 0)
|
||||
return log_netdev_error_errno(netdev, -errno, "TUNSETIFF failed on tun dev: %m");
|
||||
|
||||
if (netdev->kind == NETDEV_KIND_TAP)
|
||||
@ -83,8 +82,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Cannot resolve user name %s: %m", t->user_name);
|
||||
|
||||
r = ioctl(fd, TUNSETOWNER, uid);
|
||||
if (r < 0)
|
||||
if (ioctl(fd, TUNSETOWNER, uid) < 0)
|
||||
return log_netdev_error_errno(netdev, -errno, "TUNSETOWNER failed on tun dev: %m");
|
||||
}
|
||||
|
||||
@ -96,14 +94,12 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Cannot resolve group name %s: %m", t->group_name);
|
||||
|
||||
r = ioctl(fd, TUNSETGROUP, gid);
|
||||
if (r < 0)
|
||||
if (ioctl(fd, TUNSETGROUP, gid) < 0)
|
||||
return log_netdev_error_errno(netdev, -errno, "TUNSETGROUP failed on tun dev: %m");
|
||||
|
||||
}
|
||||
|
||||
r = ioctl(fd, TUNSETPERSIST, 1);
|
||||
if (r < 0)
|
||||
if (ioctl(fd, TUNSETPERSIST, 1) < 0)
|
||||
return log_netdev_error_errno(netdev, -errno, "TUNSETPERSIST failed on tun dev: %m");
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user