summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-09-18 19:22:09 +0200
committerTom Gundersen <teg@jklm.no>2014-09-18 19:22:09 +0200
commit543afdc63c02a5af3cf6bd2a264162f23474346a (patch)
treefc3f709b244b281e7821c36b1bc6b45e4ed2aea9
parentf901aaadd68050bc575c1c15b84f8f31fd4d494d (diff)
udev: node - warn if chmod/chown fails
No functional change, just log the warning. Fonud by Coverity. Fixes CID #1237544.
-rw-r--r--src/udev/udev-node.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index c164603795..8ef788954d 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -281,8 +281,12 @@ static int node_permissions_apply(struct udev_device *dev, bool apply,
if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) {
log_debug("set permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid);
- chmod(devnode, mode);
- chown(devnode, uid, gid);
+ err = chmod(devnode, mode);
+ if (err < 0)
+ log_warning("setting mode of %s to %#o failed: %m", devnode, mode);
+ err = chown(devnode, uid, gid);
+ if (err < 0)
+ log_warning("setting owner of %s to uid=%u, gid=%u failed: %m", devnode, uid, gid);
} else {
log_debug("preserve permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid);
}