1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

Merge pull request #10730 from yuwata/udev_device_get_ifindex_returns_zero

libudev: conserve previous behavior
This commit is contained in:
Lennart Poettering 2018-11-12 10:25:26 +01:00 committed by GitHub
commit f007824996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -52,6 +52,8 @@ int udev_device_get_ifindex(struct udev_device *udev_device) {
assert(udev_device);
r = sd_device_get_ifindex(udev_device->device, &ifindex);
if (r == -ENOENT)
return 0;
if (r < 0)
return r;

View File

@ -653,11 +653,11 @@ static bool is_devpath_busy(Manager *manager, struct event *event) {
return true;
/* check network device ifindex */
if (event->ifindex != 0 && event->ifindex == loop_event->ifindex)
if (event->ifindex > 0 && event->ifindex == loop_event->ifindex)
return true;
/* check our old name */
if (event->devpath_old != NULL && streq(loop_event->devpath, event->devpath_old)) {
if (event->devpath_old && streq(loop_event->devpath, event->devpath_old)) {
event->delaying_seqnum = loop_event->seqnum;
return true;
}
@ -672,9 +672,7 @@ static bool is_devpath_busy(Manager *manager, struct event *event) {
/* identical device event found */
if (loop_event->devpath_len == event->devpath_len) {
/* devices names might have changed/swapped in the meantime */
if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block))
continue;
if (event->ifindex != 0 && event->ifindex != loop_event->ifindex)
if (major(event->devnum) != 0 || event->ifindex > 0)
continue;
event->delaying_seqnum = loop_event->seqnum;
return true;
@ -691,9 +689,6 @@ static bool is_devpath_busy(Manager *manager, struct event *event) {
event->delaying_seqnum = loop_event->seqnum;
return true;
}
/* no matching device */
continue;
}
return false;