summaryrefslogtreecommitdiff
path: root/src/udev/udev-node.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-10-23 18:06:51 +0200
committerLennart Poettering <lennart@poettering.net>2014-10-23 21:36:56 +0200
commitd53e386db62ee7f03e7d493ae0e6db7a31a5d811 (patch)
tree450feb73621298ac0a380fecb1ad0e361b77e042 /src/udev/udev-node.c
parentc80d766c8072dd0be311dcd31c17f9719775be44 (diff)
smack: rework smack APIs a bit
a) always return negative errno error codes b) always become a noop if smack is off c) always take a NULL label as a request to remove it
Diffstat (limited to 'src/udev/udev-node.c')
-rw-r--r--src/udev/udev-node.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 803d803279..8d5bada5a4 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -294,21 +294,25 @@ static int node_permissions_apply(struct udev_device *dev, bool apply,
/* apply SECLABEL{$module}=$label */
udev_list_entry_foreach(entry, udev_list_get_entry(seclabel_list)) {
const char *name, *label;
+ int r;
name = udev_list_entry_get_name(entry);
label = udev_list_entry_get_value(entry);
if (streq(name, "selinux")) {
selinux = true;
+
if (mac_selinux_apply(devnode, label) < 0)
- log_error("SECLABEL: failed to set SELinux label '%s'", label);
+ log_error("SECLABEL: failed to set SELinux label '%s': %s", label, strerror(-r));
else
log_debug("SECLABEL: set SELinux label '%s'", label);
} else if (streq(name, "smack")) {
smack = true;
- if (mac_smack_apply(devnode, label) < 0)
- log_error("SECLABEL: failed to set SMACK label '%s'", label);
+
+ r = mac_smack_apply(devnode, label);
+ if (r < 0)
+ log_error("SECLABEL: failed to set SMACK label '%s': %s", label, strerror(-r));
else
log_debug("SECLABEL: set SMACK label '%s'", label);