diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2014-09-18 18:55:54 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-09-18 18:55:54 -0400 |
commit | 2345245fdf951ea3ac5f4dc876df1fac63a4fa75 (patch) | |
tree | 973d382efa78c9b0abe403bf03f40c5699d972f9 | |
parent | b75d8b25e4b2016785edea8989a10e10674ee237 (diff) |
src/udev/udev-node.c: replace our error handling with upstreams
eudev has had this error handling for a while. upstream finally
added it with the following commit
543afdc63c02a5af3cf6bd2a264162f23474346a
by Tom Gundersen <teg@jklm.no>. Both methods are equivalent, but
we adopt upstreams for easier maintenance.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | src/udev/udev-node.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index c54228a609..8ef788954d 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -281,11 +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); - if((chmod(devnode, mode) !=0 ) || (chown(devnode, uid,gid) !=0)) { - err = -errno; - log_error("FAILED to set permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid); - goto out; - } + 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); } |