summaryrefslogtreecommitdiff
path: root/src/udev/udevd.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-12 13:07:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-12 13:07:10 +0900
commitedc81c1ccb9542b2d179e1f88afaa3d51636624d (patch)
tree37f38a49d5363362eb43807647451d954e862761 /src/udev/udevd.c
parent8ecbc4b880b91e997babc924fccb7cbebb8b0943 (diff)
downloadsystemd-edc81c1ccb9542b2d179e1f88afaa3d51636624d.tar.gz
systemd-edc81c1ccb9542b2d179e1f88afaa3d51636624d.tar.bz2
systemd-edc81c1ccb9542b2d179e1f88afaa3d51636624d.zip
udevd: do not treat negative value as valid ifindex
Also, some conditions in is_devpath_busy() are similified.
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r--src/udev/udevd.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 0757628d0d..2664c8475e 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -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;