[systemd-commits] src/libsystemd src/machine src/modules-load src/resolve src/shared src/sysctl src/sysusers src/tmpfiles
Michal Schmidt
michich at kemper.freedesktop.org
Fri Nov 28 10:19:15 PST 2014
src/libsystemd/sd-rtnl/rtnl-util.c | 6 ++----
src/machine/machine.c | 3 +--
src/modules-load/modules-load.c | 3 +--
src/resolve/resolved-manager.c | 6 ++----
src/shared/logs-show.c | 3 +--
src/sysctl/sysctl.c | 3 +--
src/sysusers/sysusers.c | 3 +--
src/tmpfiles/tmpfiles.c | 9 +++------
8 files changed, 12 insertions(+), 24 deletions(-)
New commits:
commit 8d3d7072e609ef0e0fb37e1d19a29307d58146c3
Author: Michal Schmidt <mschmidt at redhat.com>
Date: Fri Nov 28 19:13:53 2014 +0100
treewide: a few more log_*_errno + return simplifications
The one in tmpfiles.c:create_item() even looks like it fixes a bug.
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.c b/src/libsystemd/sd-rtnl/rtnl-util.c
index bd97ba9..4521742 100644
--- a/src/libsystemd/sd-rtnl/rtnl-util.c
+++ b/src/libsystemd/sd-rtnl/rtnl-util.c
@@ -157,11 +157,9 @@ bool rtnl_message_type_is_addr(uint16_t type) {
}
int rtnl_log_parse_error(int r) {
- log_error_errno(r, "Failed to parse netlink message: %m");
- return r;
+ return log_error_errno(r, "Failed to parse netlink message: %m");
}
int rtnl_log_create_error(int r) {
- log_error_errno(r, "Failed to create netlink message: %m");
- return r;
+ return log_error_errno(r, "Failed to create netlink message: %m");
}
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 4018926..0d84213 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -259,8 +259,7 @@ int machine_load(Machine *m) {
if (r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to read %s: %m", m->state_file);
- return r;
+ return log_error_errno(r, "Failed to read %s: %m", m->state_file);
}
if (id)
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 1fd01ad..4dbacd1 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -139,8 +139,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
if (ignore_enoent && r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to open %s, ignoring: %m", path);
- return r;
+ return log_error_errno(r, "Failed to open %s, ignoring: %m", path);
}
log_debug("apply: %s", path);
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 9f61c9d..661f8fc 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -379,10 +379,8 @@ static int manager_watch_hostname(Manager *m) {
if (r == -EPERM)
/* kernels prior to 3.2 don't support polling this file. Ignore the failure. */
m->hostname_fd = safe_close(m->hostname_fd);
- else {
- log_error_errno(r, "Failed to add hostname event source: %m");
- return r;
- }
+ else
+ return log_error_errno(r, "Failed to add hostname event source: %m");
}
r = determine_hostname(&m->hostname);
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 2da4ef3..98972ed 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -858,8 +858,7 @@ static int output_cat(
if (r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to get data: %m");
- return r;
+ return log_error_errno(r, "Failed to get data: %m");
}
assert(l >= 8);
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index 346ff3b..2d1ae6e 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -134,8 +134,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
if (ignore_enoent && r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
- return r;
+ return log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
}
log_debug("parse: %s", path);
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 3a56b6b..845a307 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -1709,8 +1709,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
if (ignore_enoent && r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
- return r;
+ return log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
}
f = rf;
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 1a4f02d..45d31fb 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -667,10 +667,8 @@ static int create_item(Item *i) {
if (r < 0) {
struct stat a, b;
- if (r != -EEXIST) {
- log_error_errno(r, "Failed to copy files to %s: %m", i->path);
- return -r;
- }
+ if (r != -EEXIST)
+ return log_error_errno(r, "Failed to copy files to %s: %m", i->path);
if (stat(i->argument, &a) < 0) {
log_error("stat(%s) failed: %m", i->argument);
@@ -1519,8 +1517,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
if (ignore_enoent && r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
- return r;
+ return log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
}
FOREACH_LINE(line, f, break) {
More information about the systemd-commits
mailing list