summaryrefslogtreecommitdiffstats
path: root/src/udev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-09-08 19:10:27 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-09-08 19:34:38 +0200
commitab54f12b783eea891d6414fbc14cd6fe7cbe4c80 (patch)
treeb75d0dc8e6fa95f7d8bfa39c31e47c8f30c10f55 /src/udev
parentudev: explicitly specify return value (diff)
downloadsystemd-ab54f12b783eea891d6414fbc14cd6fe7cbe4c80.tar.xz
systemd-ab54f12b783eea891d6414fbc14cd6fe7cbe4c80.zip
sd-device: make log_device_error() or friends return void
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-builtin-uaccess.c4
-rw-r--r--src/udev/udev-event.c2
-rw-r--r--src/udev/udev-node.c22
-rw-r--r--src/udev/udev-rules.c6
-rw-r--r--src/udev/udev-watch.c6
5 files changed, 19 insertions, 21 deletions
diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c
index 63401a570e..d552316eee 100644
--- a/src/udev/udev-builtin-uaccess.c
+++ b/src/udev/udev-builtin-uaccess.c
@@ -50,7 +50,7 @@ static int builtin_uaccess(sd_device *dev, int argc, char *argv[], bool test) {
r = devnode_acl(path, true, false, 0, true, uid);
if (r < 0) {
- log_device_full(dev, r == -ENOENT ? LOG_DEBUG : LOG_ERR, r, "Failed to apply ACL: %m");
+ log_device_full_errno(dev, r == -ENOENT ? LOG_DEBUG : LOG_ERR, r, "Failed to apply ACL: %m");
goto finish;
}
@@ -64,7 +64,7 @@ finish:
/* Better be safe than sorry and reset ACL */
k = devnode_acl(path, true, false, 0, false, 0);
if (k < 0) {
- log_device_full(dev, k == -ENOENT ? LOG_DEBUG : LOG_ERR, k, "Failed to apply ACL: %m");
+ log_device_full_errno(dev, k == -ENOENT ? LOG_DEBUG : LOG_ERR, k, "Failed to apply ACL: %m");
if (r >= 0)
r = k;
}
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 3fe4ac7e6a..e7208c62b0 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -633,7 +633,7 @@ static int on_spawn_sigchld(sd_event_source *s, const siginfo_t *si, void *userd
if (si->si_status == 0)
log_device_debug(spawn->device, "Process '%s' succeeded.", spawn->cmd);
else
- log_device_full(spawn->device, spawn->accept_failure ? LOG_DEBUG : LOG_WARNING, 0,
+ log_device_full(spawn->device, spawn->accept_failure ? LOG_DEBUG : LOG_WARNING,
"Process '%s' failed with exit code %i.", spawn->cmd, si->si_status);
ret = si->si_status;
break;
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 541d48189f..bc259dd6f6 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -324,13 +324,13 @@ static int node_permissions_apply(sd_device *dev, bool apply_mac,
r = chmod_and_chown(devnode, mode, uid, gid);
if (r < 0)
- log_device_full(dev, r == -ENOENT ? LOG_DEBUG : LOG_ERR, r,
- "Failed to set owner/mode of %s to uid=" UID_FMT
- ", gid=" GID_FMT ", mode=%#o: %m",
- devnode,
- uid_is_valid(uid) ? uid : stats.st_uid,
- gid_is_valid(gid) ? gid : stats.st_gid,
- mode != MODE_INVALID ? mode & 0777 : stats.st_mode & 0777);
+ log_device_full_errno(dev, r == -ENOENT ? LOG_DEBUG : LOG_ERR, r,
+ "Failed to set owner/mode of %s to uid=" UID_FMT
+ ", gid=" GID_FMT ", mode=%#o: %m",
+ devnode,
+ uid_is_valid(uid) ? uid : stats.st_uid,
+ gid_is_valid(gid) ? gid : stats.st_gid,
+ mode != MODE_INVALID ? mode & 0777 : stats.st_mode & 0777);
} else
log_device_debug(dev, "Preserve permissions of %s, uid=" UID_FMT ", gid=" GID_FMT ", mode=%#o",
devnode,
@@ -347,8 +347,8 @@ static int node_permissions_apply(sd_device *dev, bool apply_mac,
q = mac_selinux_apply(devnode, label);
if (q < 0)
- log_device_full(dev, q == -ENOENT ? LOG_DEBUG : LOG_ERR, q,
- "SECLABEL: failed to set SELinux label '%s': %m", label);
+ log_device_full_errno(dev, q == -ENOENT ? LOG_DEBUG : LOG_ERR, q,
+ "SECLABEL: failed to set SELinux label '%s': %m", label);
else
log_device_debug(dev, "SECLABEL: set SELinux label '%s'", label);
@@ -357,8 +357,8 @@ static int node_permissions_apply(sd_device *dev, bool apply_mac,
q = mac_smack_apply(devnode, SMACK_ATTR_ACCESS, label);
if (q < 0)
- log_device_full(dev, q == -ENOENT ? LOG_DEBUG : LOG_ERR, q,
- "SECLABEL: failed to set SMACK label '%s': %m", label);
+ log_device_full_errno(dev, q == -ENOENT ? LOG_DEBUG : LOG_ERR, q,
+ "SECLABEL: failed to set SMACK label '%s': %m", label);
else
log_device_debug(dev, "SECLABEL: set SMACK label '%s'", label);
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index c758965239..437429a3e0 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -189,9 +189,9 @@ struct UdevRules {
UdevRuleLine *_l = _f ? _f->current_line : NULL; \
const char *_n = _f ? _f->filename : NULL; \
\
- log_device_full(device, level, error, "%s:%u " fmt, \
- strna(_n), _l ? _l->line_number : 0, \
- ##__VA_ARGS__); \
+ log_device_full_errno(device, level, error, "%s:%u " fmt, \
+ strna(_n), _l ? _l->line_number : 0, \
+ ##__VA_ARGS__); \
})
#define log_rule_full(device, rules, level, ...) (void) log_rule_full_errno(device, rules, level, 0, __VA_ARGS__)
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 96a25ddf7c..d87a43537c 100644
--- a/src/udev/udev-watch.c
+++ b/src/udev/udev-watch.c
@@ -97,10 +97,8 @@ int udev_watch_begin(sd_device *dev) {
log_device_debug(dev, "Adding watch on '%s'", devnode);
wd = inotify_add_watch(inotify_fd, devnode, IN_CLOSE_WRITE);
if (wd < 0)
- return log_device_full(dev,
- errno == ENOENT ? LOG_DEBUG : LOG_ERR,
- errno,
- "Failed to add device '%s' to watch: %m", devnode);
+ return log_device_full_errno(dev, errno == ENOENT ? LOG_DEBUG : LOG_ERR, errno,
+ "Failed to add device '%s' to watch: %m", devnode);
device_set_watch_handle(dev, wd);