diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 00129ff77da..f134f0a8c98 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -269,13 +269,11 @@ _public_ int sd_uid_get_state(uid_t uid, char**state) { return r; r = parse_env_file(NULL, p, "STATE", &s); - if (r == -ENOENT) { + if (r == -ENOENT) r = free_and_strdup(&s, "offline"); - if (r < 0) - return r; - } else if (r < 0) + if (r < 0) return r; - else if (isempty(s)) + if (isempty(s)) return -EIO; *state = TAKE_PTR(s); diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c index 10d2ed7aece..9759f461631 100644 --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c @@ -157,7 +157,6 @@ int locale_read_data(Context *c, sd_bus_message *m) { int vconsole_read_data(Context *c, sd_bus_message *m) { struct stat st; usec_t t; - int r; /* Do not try to re-read the file within single bus operation. */ if (m) { @@ -185,13 +184,9 @@ int vconsole_read_data(Context *c, sd_bus_message *m) { c->vc_mtime = t; context_free_vconsole(c); - r = parse_env_file(NULL, "/etc/vconsole.conf", - "KEYMAP", &c->vc_keymap, - "KEYMAP_TOGGLE", &c->vc_keymap_toggle); - if (r < 0) - return r; - - return 0; + return parse_env_file(NULL, "/etc/vconsole.conf", + "KEYMAP", &c->vc_keymap, + "KEYMAP_TOGGLE", &c->vc_keymap_toggle); } int x11_read_data(Context *c, sd_bus_message *m) { diff --git a/src/login/logind-session.c b/src/login/logind-session.c index ab98a5055df..eef48c25275 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -445,7 +445,6 @@ int session_load(Session *s) { "ACTIVE", &active, "DEVICES", &devices, "IS_DISPLAY", &is_display); - if (r < 0) return log_error_errno(r, "Failed to read %s: %m", s->state_file); diff --git a/src/machine/machine.c b/src/machine/machine.c index 80f73da94a8..b202220b879 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -265,12 +265,10 @@ int machine_load(Machine *m) { "REALTIME", &realtime, "MONOTONIC", &monotonic, "NETIF", &netif); - if (r < 0) { - if (r == -ENOENT) - return 0; - + if (r == -ENOENT) + return 0; + if (r < 0) return log_error_errno(r, "Failed to read %s: %m", m->state_file); - } if (id) sd_id128_from_string(id, &m->id);