mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 10:51:20 +03:00
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:
parent
f647962d64
commit
8d3d7072e6
@ -157,11 +157,9 @@ bool rtnl_message_type_is_addr(uint16_t type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rtnl_log_parse_error(int r) {
|
int rtnl_log_parse_error(int r) {
|
||||||
log_error_errno(r, "Failed to parse netlink message: %m");
|
return log_error_errno(r, "Failed to parse netlink message: %m");
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtnl_log_create_error(int r) {
|
int rtnl_log_create_error(int r) {
|
||||||
log_error_errno(r, "Failed to create netlink message: %m");
|
return log_error_errno(r, "Failed to create netlink message: %m");
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
@ -259,8 +259,7 @@ int machine_load(Machine *m) {
|
|||||||
if (r == -ENOENT)
|
if (r == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_error_errno(r, "Failed to read %s: %m", m->state_file);
|
return log_error_errno(r, "Failed to read %s: %m", m->state_file);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
|
@ -139,8 +139,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
|
|||||||
if (ignore_enoent && r == -ENOENT)
|
if (ignore_enoent && r == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_error_errno(r, "Failed to open %s, ignoring: %m", path);
|
return log_error_errno(r, "Failed to open %s, ignoring: %m", path);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("apply: %s", path);
|
log_debug("apply: %s", path);
|
||||||
|
@ -379,10 +379,8 @@ static int manager_watch_hostname(Manager *m) {
|
|||||||
if (r == -EPERM)
|
if (r == -EPERM)
|
||||||
/* kernels prior to 3.2 don't support polling this file. Ignore the failure. */
|
/* kernels prior to 3.2 don't support polling this file. Ignore the failure. */
|
||||||
m->hostname_fd = safe_close(m->hostname_fd);
|
m->hostname_fd = safe_close(m->hostname_fd);
|
||||||
else {
|
else
|
||||||
log_error_errno(r, "Failed to add hostname event source: %m");
|
return log_error_errno(r, "Failed to add hostname event source: %m");
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = determine_hostname(&m->hostname);
|
r = determine_hostname(&m->hostname);
|
||||||
|
@ -858,8 +858,7 @@ static int output_cat(
|
|||||||
if (r == -ENOENT)
|
if (r == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_error_errno(r, "Failed to get data: %m");
|
return log_error_errno(r, "Failed to get data: %m");
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(l >= 8);
|
assert(l >= 8);
|
||||||
|
@ -134,8 +134,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
|
|||||||
if (ignore_enoent && r == -ENOENT)
|
if (ignore_enoent && r == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
|
return log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("parse: %s", path);
|
log_debug("parse: %s", path);
|
||||||
|
@ -1709,8 +1709,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
|
|||||||
if (ignore_enoent && r == -ENOENT)
|
if (ignore_enoent && r == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
|
return log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f = rf;
|
f = rf;
|
||||||
|
@ -667,10 +667,8 @@ static int create_item(Item *i) {
|
|||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
struct stat a, b;
|
struct stat a, b;
|
||||||
|
|
||||||
if (r != -EEXIST) {
|
if (r != -EEXIST)
|
||||||
log_error_errno(r, "Failed to copy files to %s: %m", i->path);
|
return log_error_errno(r, "Failed to copy files to %s: %m", i->path);
|
||||||
return -r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat(i->argument, &a) < 0) {
|
if (stat(i->argument, &a) < 0) {
|
||||||
log_error("stat(%s) failed: %m", i->argument);
|
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)
|
if (ignore_enoent && r == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
|
return log_error_errno(r, "Failed to open '%s', ignoring: %m", fn);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_LINE(line, f, break) {
|
FOREACH_LINE(line, f, break) {
|
||||||
|
Loading…
Reference in New Issue
Block a user