diff options
author | Kay Sievers <kay@vrfy.org> | 2014-04-02 15:47:09 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-04-03 08:55:58 -0400 |
commit | 40c72b0478f406163be683c182a0f3fd210a39ae (patch) | |
tree | 32b0ee9de6657d88d6f21361bd77cd0311d5bebf | |
parent | 5aafc733e796c2bb258ea373146dba4d3c07a83a (diff) |
udev: do not export "static node" tags for non-existing devices
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | src/udev/udev-rules.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index d581c58faa..e05f48c0a1 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -2625,10 +2625,15 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) struct stat stats; /* 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) + break; + if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) + break; /* export the tags to a directory as symlinks, allowing otherwise dead nodes to be tagged */ if (tags) { @@ -2658,11 +2663,6 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) if (mode == 0 && uid == 0 && gid == 0) 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) mode = 0660; |