treewide: a few more log_*_errno + return simplifications

The one in tmpfiles.c:create_item() even looks like it fixes a bug.
This commit is contained in:
Michal Schmidt 2014-11-28 19:13:53 +01:00
parent f647962d64
commit 8d3d7072e6
8 changed files with 12 additions and 24 deletions

View file

@ -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");
}

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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) {