summaryrefslogtreecommitdiffstats
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-05 20:18:47 +0200
committerLennart Poettering <lennart@poettering.net>2018-06-07 15:29:17 +0200
commitb8b846d7b4c20bd1ac8c72e49e9d134ce8bd5213 (patch)
tree0da42b03f22ad9adab192600c6661fa3c35ea0ce /src/basic
parentcore: enumerate perpetual units in a separate per-unit-type method (diff)
downloadsystemd-b8b846d7b4c20bd1ac8c72e49e9d134ce8bd5213.tar.xz
systemd-b8b846d7b4c20bd1ac8c72e49e9d134ce8bd5213.zip
tree-wide: fix a number of log calls that use %m but have no errno set
This is mostly fall-out from d1a1f0aaf0d2f08c60d1e0d32e646439d99f58dc, however some cases are older bugs. There might be more issues lurking, this was a simple grep for "%m" across the tree, with all lines removed that mention "errno" at all.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/conf-files.c2
-rw-r--r--src/basic/fs-util.c6
-rw-r--r--src/basic/selinux-util.c14
3 files changed, 11 insertions, 11 deletions
diff --git a/src/basic/conf-files.c b/src/basic/conf-files.c
index 2e65a6e74f..15a066da7f 100644
--- a/src/basic/conf-files.c
+++ b/src/basic/conf-files.c
@@ -349,7 +349,7 @@ int conf_files_cat(const char *root, const char *name) {
assert(endswith(dir, "/"));
r = strv_extendf(&dirs, "%s%s.d", dir, name);
if (r < 0)
- return log_error("Failed to build directory list: %m");
+ return log_error_errno(r, "Failed to build directory list: %m");
}
r = conf_files_list_strv(&files, ".conf", root, 0, (const char* const*) dirs);
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 6146c66782..ab6ccf7c86 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -1155,9 +1155,9 @@ int fsync_directory_of_file(int fd) {
r = fd_get_path(fd, &path);
if (r < 0) {
- log_debug("Failed to query /proc/self/fd/%d%s: %m",
- fd,
- r == -EOPNOTSUPP ? ", ignoring" : "");
+ log_debug_errno(r, "Failed to query /proc/self/fd/%d%s: %m",
+ fd,
+ r == -EOPNOTSUPP ? ", ignoring" : "");
if (r == -EOPNOTSUPP)
/* If /proc is not available, we're most likely running in some
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
index aba3e4f15d..61504a673a 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -79,7 +79,7 @@ int mac_selinux_init(void) {
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
if (!label_hnd) {
- log_enforcing("Failed to initialize SELinux context: %m");
+ log_enforcing_errno(errno, "Failed to initialize SELinux context: %m");
r = security_getenforce() == 1 ? -errno : 0;
} else {
char timespan[FORMAT_TIMESPAN_MAX];
@@ -189,7 +189,7 @@ int mac_selinux_apply(const char *path, const char *label) {
assert(label);
if (setfilecon(path, label) < 0) {
- log_enforcing("Failed to set SELinux security context %s on path %s: %m", label, path);
+ log_enforcing_errno(errno, "Failed to set SELinux security context %s on path %s: %m", label, path);
if (security_getenforce() > 0)
return -errno;
}
@@ -349,12 +349,12 @@ int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
if (errno == ENOENT)
return 0;
- log_enforcing("Failed to determine SELinux security context for %s: %m", path);
+ log_enforcing_errno(errno, "Failed to determine SELinux security context for %s: %m", path);
} else {
if (setfscreatecon_raw(filecon) >= 0)
return 0; /* Success! */
- log_enforcing("Failed to set SELinux security context %s for %s: %m", filecon, path);
+ log_enforcing_errno(errno, "Failed to set SELinux security context %s for %s: %m", filecon, path);
}
if (security_getenforce() > 0)
@@ -385,7 +385,7 @@ int mac_selinux_create_socket_prepare(const char *label) {
assert(label);
if (setsockcreatecon(label) < 0) {
- log_enforcing("Failed to set SELinux security context %s for sockets: %m", label);
+ log_enforcing_errno(errno, "Failed to set SELinux security context %s for sockets: %m", label);
if (security_getenforce() == 1)
return -errno;
@@ -457,13 +457,13 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
if (errno == ENOENT)
goto skipped;
- log_enforcing("Failed to determine SELinux security context for %s: %m", path);
+ log_enforcing_errno(errno, "Failed to determine SELinux security context for %s: %m", path);
if (security_getenforce() > 0)
return -errno;
} else {
if (setfscreatecon_raw(fcon) < 0) {
- log_enforcing("Failed to set SELinux security context %s for %s: %m", fcon, path);
+ log_enforcing_errno(errno, "Failed to set SELinux security context %s for %s: %m", fcon, path);
if (security_getenforce() > 0)
return -errno;
} else