summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:13:53 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:17:24 +0100
commit8d3d7072e609ef0e0fb37e1d19a29307d58146c3 (patch)
tree96a7628cd8bbf315bd9ca55e87eb2dd3cb50e054 /src
parentf647962d64e844689f3e2acfce6102fc47e76df2 (diff)
treewide: a few more log_*_errno + return simplifications
The one in tmpfiles.c:create_item() even looks like it fixes a bug.
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-util.c6
-rw-r--r--src/machine/machine.c3
-rw-r--r--src/modules-load/modules-load.c3
-rw-r--r--src/resolve/resolved-manager.c6
-rw-r--r--src/shared/logs-show.c3
-rw-r--r--src/sysctl/sysctl.c3
-rw-r--r--src/sysusers/sysusers.c3
-rw-r--r--src/tmpfiles/tmpfiles.c9
8 files changed, 12 insertions, 24 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.c b/src/libsystemd/sd-rtnl/rtnl-util.c
index bd97ba9ae7..4521742b8e 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 40189269e0..0d84213eea 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 1fd01adbe4..4dbacd13dc 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 9f61c9d9a2..661f8fc738 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 2da4ef3e12..98972eda3b 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 346ff3b237..2d1ae6e8b1 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 3a56b6b482..845a307ae7 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 1a4f02db33..45d31fb5d8 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) {