if (!enumerator->match_allow_uninitialized &&
!initialized &&
(sd_device_get_devnum(device, &devnum) >= 0 ||
- (sd_device_get_ifindex(device, &ifindex) >= 0 && ifindex > 0)))
+ sd_device_get_ifindex(device, &ifindex) >= 0))
continue;
if (!match_parent(enumerator, device))
*device = (sd_device) {
.n_ref = 1,
.watch_handle = -1,
- .ifindex = -1,
.devmode = (mode_t) -1,
.devuid = (uid_t) -1,
.devgid = (gid_t) -1,
if (r < 0)
return r;
- if (device->ifindex < 0)
+ if (device->ifindex <= 0)
return -ENOENT;
*ifindex = device->ifindex;
major(devnum), minor(devnum));
if (r < 0)
return -ENOMEM;
- } else if (sd_device_get_ifindex(device, &ifindex) >= 0 && ifindex > 0) {
+ } else if (sd_device_get_ifindex(device, &ifindex) >= 0) {
/* use netdev ifindex — n3 */
- r = asprintf(&id, "n%u", ifindex);
+ r = asprintf(&id, "n%u", (unsigned) ifindex);
if (r < 0)
return -ENOMEM;
} else {