summaryrefslogtreecommitdiff
path: root/udev/udev-rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-08-11 20:33:17 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-08-11 20:37:49 +0200
commit79449642ebcb6170adb8d6391518e328a07d9552 (patch)
tree63583426345bbc26ec8f755a6edfc09482c9c0ab /udev/udev-rules.c
parent2a30eaa452ad614c1957735fef47a7bc200db9cd (diff)
do not remove static nodes on module unload
Diffstat (limited to 'udev/udev-rules.c')
-rw-r--r--udev/udev-rules.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index 742d88b3d5..6bf2726e1e 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -2572,6 +2572,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
rule->rule.filename_line);
break;
case TK_A_STATIC_NODE:
+ event->static_node = true;
break;
case TK_A_ENV: {
const char *name = &rules->buf[cur->key.attr_off];
@@ -2793,10 +2794,15 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules)
goto next;
if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode))
goto next;
-
- if (mode == 0 && gid > 0)
- mode = 0660;
- if (mode != (stats.st_mode & 0777)) {
+ if (mode == 0) {
+ if (gid > 0)
+ mode = 0660;
+ else
+ mode = 0600;
+ }
+ /* set sticky bit, so we do not remove the node on module unload */
+ mode |= 01000;
+ if (mode != (stats.st_mode & 01777)) {
chmod(filename, mode);
info(rules->udev, "chmod '%s' %#o\n", filename, mode);
}