[systemd-commits] 2 commits - src/udev
Tom Gundersen
tomegun at kemper.freedesktop.org
Wed Jul 24 06:13:10 PDT 2013
src/udev/udev-rules.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
New commits:
commit 15a722007dc1d8a9a11934b2ab528cf4d25b6c62
Author: Tom Gundersen <teg at jklm.no>
Date: Wed Jul 24 15:05:48 2013 +0200
udev: static_node - don't touch permissions uneccessarily
Don't set default permissions if only TAGS were specified in a rule.
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index fe4965f..769b670 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2586,6 +2586,10 @@ 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;
+
if (mode == 0) {
if (gid > 0)
mode = 0660;
commit 490f0087627f441d5fece276ec86b64b5a9d6495
Author: Tom Gundersen <teg at jklm.no>
Date: Wed Jul 24 14:55:19 2013 +0200
udev: log error if chmod/chown of static dev nodes fails
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 8ace705..fe4965f 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2593,13 +2593,21 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
mode = 0600;
}
if (mode != (stats.st_mode & 01777)) {
- chmod(device_node, mode);
- log_debug("chmod '%s' %#o\n", device_node, mode);
+ r = chmod(device_node, mode);
+ if (r < 0) {
+ log_error("failed to chmod '%s' %#o\n", device_node, mode);
+ return -errno;
+ } else
+ log_debug("chmod '%s' %#o\n", device_node, mode);
}
if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) {
- chown(device_node, uid, gid);
- log_debug("chown '%s' %u %u\n", device_node, uid, gid);
+ r = chown(device_node, uid, gid);
+ if (r < 0) {
+ log_error("failed to chown '%s' %u %u \n", device_node, uid, gid);
+ return -errno;
+ } else
+ log_debug("chown '%s' %u %u\n", device_node, uid, gid);
}
utimensat(AT_FDCWD, device_node, NULL, 0);
More information about the systemd-commits
mailing list