tun: Fix warning

tun.c:389:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (addr.sc_unit < 0) {
            ~~~~~~~~~~~~ ^ ~
This commit is contained in:
Erik Ekman 2021-05-14 13:38:51 +02:00
parent 4c46580e43
commit d02f1b4f41

View file

@ -360,6 +360,7 @@ open_utun(const char *dev)
struct ctl_info info;
char ifname[10];
socklen_t ifname_len = sizeof(ifname);
int unit;
int fd = -1;
int err = 0;
@ -385,11 +386,12 @@ open_utun(const char *dev)
addr.sc_family = AF_SYSTEM;
addr.ss_sysaddr = AF_SYS_CONTROL;
addr.sc_id = info.ctl_id;
addr.sc_unit = utun_unit(dev);
if (addr.sc_unit < 0) {
unit = utun_unit(dev);
if (unit < 0) {
close(fd);
return -1;
}
addr.sc_unit = unit;
err = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
if (err != 0) {