chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update default rules
[elogind.git]
/
udev_rules_parse.c
diff --git
a/udev_rules_parse.c
b/udev_rules_parse.c
index 5e93e60d4f97f906cc216f522cbed3b9aac3cdb7..ecb6a7be31b1133ab2a104c02dbcded411a13ba6 100644
(file)
--- a/
udev_rules_parse.c
+++ b/
udev_rules_parse.c
@@
-219,7
+219,7
@@
static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs,
size_t key_len = strnlen(key, PATH_SIZE);
if (pairs->count >= PAIRS_MAX) {
size_t key_len = strnlen(key, PATH_SIZE);
if (pairs->count >= PAIRS_MAX) {
- err("skip, too many keys in a single rule");
+ err("skip, too many keys
of the same type
in a single rule");
return -1;
}
return -1;
}
@@
-322,17
+322,13
@@
static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
}
if (strncasecmp(key, "ATTR", sizeof("ATTR")-1) == 0) {
}
if (strncasecmp(key, "ATTR", sizeof("ATTR")-1) == 0) {
- if (operation != KEY_OP_MATCH &&
- operation != KEY_OP_NOMATCH) {
- err("invalid ATTR operation");
- goto invalid;
- }
attr = get_key_attribute(key + sizeof("ATTR")-1);
if (attr == NULL) {
attr = get_key_attribute(key + sizeof("ATTR")-1);
if (attr == NULL) {
- err("error parsing ATTR attribute
in '%s'", line
);
-
continue
;
+ err("error parsing ATTR attribute
"
);
+
goto invalid
;
}
}
- add_rule_key_pair(rule, &rule->attr, operation, attr, value);
+ if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0)
+ goto invalid;
valid = 1;
continue;
}
valid = 1;
continue;
}
@@
-374,17
+370,13
@@
static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
if (strncasecmp(key, "ATTRS", sizeof("ATTRS")-1) == 0 ||
strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) {
if (strncasecmp(key, "ATTRS", sizeof("ATTRS")-1) == 0 ||
strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) {
- if (operation != KEY_OP_MATCH &&
- operation != KEY_OP_NOMATCH) {
- err("invalid ATTRSS operation");
- goto invalid;
- }
attr = get_key_attribute(key + sizeof("ATTRS")-1);
if (attr == NULL) {
attr = get_key_attribute(key + sizeof("ATTRS")-1);
if (attr == NULL) {
- err("error parsing ATTRS attribute
in '%s'", line
);
-
continue
;
+ err("error parsing ATTRS attribute
"
);
+
goto invalid
;
}
}
- add_rule_key_pair(rule, &rule->attrs, operation, attr, value);
+ if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0)
+ goto invalid;
valid = 1;
continue;
}
valid = 1;
continue;
}
@@
-393,9
+385,10
@@
static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
attr = get_key_attribute(key + sizeof("ENV")-1);
if (attr == NULL) {
err("error parsing ENV attribute");
attr = get_key_attribute(key + sizeof("ENV")-1);
if (attr == NULL) {
err("error parsing ENV attribute");
-
continue
;
+
goto invalid
;
}
}
- add_rule_key_pair(rule, &rule->env, operation, attr, value);
+ if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0)
+ goto invalid;
valid = 1;
continue;
}
valid = 1;
continue;
}