summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-01-22 10:47:48 +0100
committerAnthony G. Basile <blueness@gentoo.org>2014-01-27 06:47:00 -0500
commitab1b8777622a86db7832dc4cc3817c6d44b74c20 (patch)
treeab49a07c40667eb374198db59d9c2a2018fd2729 /src
parent37e6139e2acfc9a2bbf87ec10d8290d7bfa8aa3c (diff)
udev: static_node - do not exit rule after first static_node item
The nodes usually do not exist, so handle the next item instead of skipping the entire rule. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/udev/udev-rules.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index a57dd8ebd3..d129b0f3a0 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -905,6 +905,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
case TK_A_GOTO:
case TK_M_TAG:
case TK_A_TAG:
+ case TK_A_STATIC_NODE:
token->key.value_off = rules_add_string(rule_tmp->rules, value);
break;
case TK_M_IMPORT_BUILTIN:
@@ -948,9 +949,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
case TK_A_MODE_ID:
token->key.mode = *(mode_t *)data;
break;
- case TK_A_STATIC_NODE:
- token->key.value_off = rules_add_string(rule_tmp->rules, value);
- break;
case TK_M_EVENT_TIMEOUT:
token->key.event_timeout = *(int *)data;
break;
@@ -998,7 +996,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
}
if (attr != NULL) {
- /* check if property/attribut name has substitution chars */
+ /* check if property/attribute name has substitution chars */
if (attr[0] == '[')
token->key.attrsubst = SB_SUBSYS;
else if (strchr(attr, '%') != NULL || strchr(attr, '$') != NULL)
@@ -2631,15 +2629,11 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
/* we assure, that the permissions tokens are sorted before the static token */
if (mode == 0 && uid == 0 && gid == 0 && tags == NULL)
goto next;
+
strscpyl(device_node, sizeof(device_node), "/dev/", rules_str(rules, cur->key.value_off), NULL);
- if (stat(device_node, &stats) != 0)
- goto next;
- if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode))
- goto next;
+ /* export the tags to a directory as symlinks, allowing otherwise dead nodes to be tagged */
if (tags) {
- /* Export the tags to a directory as symlinks, allowing otherwise dead nodes to be tagged */
-
STRV_FOREACH(t, tags) {
_cleanup_free_ char *unescaped_filename = NULL;
@@ -2664,7 +2658,12 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
/* don't touch the permissions if only the tags were set */
if (mode == 0 && uid == 0 && gid == 0)
- goto next;
+ break;
+
+ if (stat(device_node, &stats) != 0)
+ break;
+ if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode))
+ break;
if (mode == 0) {
if (gid > 0)