From: Kay Sievers Date: Tue, 31 Jan 2006 15:24:22 +0000 (+0100) Subject: make WAIT_FOR_SYSFS usable in non "wait-only" rules X-Git-Tag: 174~2360 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=f8db897faaaf3417ed0a31a39c7f47cc8cf40bd6;hp=66c2bc212087d02faf77520b52ef6177d5c351fa make WAIT_FOR_SYSFS usable in non "wait-only" rules Thanks to Andrey Borzenkov for noticing this and the initial patch to fix it. Signed-off-by: Kay Sievers --- diff --git a/udev_rules.c b/udev_rules.c index 8e9c1605b..e9b32df1c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -733,19 +733,13 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { - int match; + int found; - match = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); - if (match && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS is true (matching value)"); - return 0; - } - if (!match && (rule->wait_for_sysfs.operation == KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS is true, (non matching value)"); - return 0; + found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); + if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { + dbg("WAIT_FOR_SYSFS failed"); + goto nomatch; } - dbg("WAIT_FOR_SYSFS is false"); - return -1; } /* walk up the chain of parent devices and find a match */