From 0bd0407efcdd88614b2b948952c0bb071f73a317 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 29 Jan 2019 13:53:13 +0100 Subject: [PATCH] udevd: trivial refactoring of is_device_busy() --- src/udev/udevd.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index c637b98c7c..488a980742 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -743,10 +743,8 @@ static int is_device_busy(Manager *manager, struct event *event) { continue; /* check our old name */ - if (devpath_old && streq(devpath_old, loop_devpath)) { - event->delaying_seqnum = loop_event->seqnum; - return true; - } + if (devpath_old && streq(devpath_old, loop_devpath)) + goto set_delaying_seqnum; loop_devpath_len = strlen(loop_devpath); @@ -762,24 +760,23 @@ static int is_device_busy(Manager *manager, struct event *event) { /* devices names might have changed/swapped in the meantime */ if (major(devnum) != 0 || ifindex > 0) continue; - event->delaying_seqnum = loop_event->seqnum; - return true; + goto set_delaying_seqnum; } /* parent device event found */ - if (devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; - return true; - } + if (devpath[common] == '/') + goto set_delaying_seqnum; /* child device event found */ - if (loop_devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; - return true; - } + if (loop_devpath[common] == '/') + goto set_delaying_seqnum; } return false; + +set_delaying_seqnum: + event->delaying_seqnum = loop_event->seqnum; + return true; } static int on_exit_timeout(sd_event_source *s, uint64_t usec, void *userdata) {