chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
udevd: fix termination of rule execution
[elogind.git]
/
udev
/
udev-rules.c
diff --git
a/udev/udev-rules.c
b/udev/udev-rules.c
index a6f9220352de5fc6caa1542019ee7da81f487253..77029f7bec024e2ec9d90164520816b202cc59e4 100644
(file)
--- a/
udev/udev-rules.c
+++ b/
udev/udev-rules.c
@@
-1808,11
+1808,10
@@
static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct
const char *val;
val = udev_device_get_sysattr_value(dev, key_name);
const char *val;
val = udev_device_get_sysattr_value(dev, key_name);
- if (val != NULL)
- util_strlcpy(value, val, sizeof(value));
+ if (val == NULL)
+ return -1;
+ util_strlcpy(value, val, sizeof(value));
}
}
- if (value[0] == '\0')
- return -1;
/* strip trailing whitespace of value, if not asked to match for it */
len = strlen(key_value);
/* strip trailing whitespace of value, if not asked to match for it */
len = strlen(key_value);
@@
-1843,7
+1842,7
@@
int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
/* loop through token list, match, run actions or forward to next rule */
cur = &rules->tokens[0];
rule = cur;
/* loop through token list, match, run actions or forward to next rule */
cur = &rules->tokens[0];
rule = cur;
- while (
cur != NULL && cur->type != TK_END
) {
+ while (
1
) {
unsigned int idx;
dump_token(rules, cur);
unsigned int idx;
dump_token(rules, cur);
@@
-2319,11
+2318,11
@@
int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
cur = &rules->tokens[cur->key.rule_goto];
continue;
case TK_A_LAST_RULE:
cur = &rules->tokens[cur->key.rule_goto];
continue;
case TK_A_LAST_RULE:
- break;
+ case TK_END:
+ return 0;
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
- case TK_END:
case TK_UNSET:
err(rules->udev, "wrong type %u\n", cur->type);
goto nomatch;
case TK_UNSET:
err(rules->udev, "wrong type %u\n", cur->type);
goto nomatch;
@@
-2335,9
+2334,8
@@
int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
/* fast-forward to next rule */
idx = rule->rule.next_rule;
if (idx == 0)
/* fast-forward to next rule */
idx = rule->rule.next_rule;
if (idx == 0)
-
break
;
+
return 0
;
dbg(rules->udev, "forward to rule: %u\n", idx);
cur = &rules->tokens[idx];
}
dbg(rules->udev, "forward to rule: %u\n", idx);
cur = &rules->tokens[idx];
}
- return 0;
}
}