summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--udev/udevd.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 21fd6f82e7..0bacb3994b 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -310,26 +310,24 @@ static int mem_size_mb(void)
static int compare_devpath(const char *running, const char *waiting)
{
- int i;
+ int i = 0;
- for (i = 0; i < UTIL_PATH_SIZE; i++) {
- /* identical device event found */
- if (running[i] == '\0' && waiting[i] == '\0')
- return 1;
+ while (running[i] == waiting[i] && running[i] != '\0')
+ i++;
- /* parent device event found */
- if (running[i] == '\0' && waiting[i] == '/')
- return 2;
+ /* identical device event found */
+ if (running[i] == '\0' && waiting[i] == '\0')
+ return 1;
- /* child device event found */
- if (running[i] == '/' && waiting[i] == '\0')
- return 3;
+ /* parent device event found */
+ if (running[i] == '\0' && waiting[i] == '/')
+ return 2;
- /* no matching event */
- if (running[i] != waiting[i])
- break;
- }
+ /* child device event found */
+ if (running[i] == '/' && waiting[i] == '\0')
+ return 3;
+ /* no matching event */
return 0;
}