1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

pam_systemd: reduce append_session_cg_weight() indentation level a bit by moving to early exit

This commit is contained in:
Lennart Poettering 2018-07-20 11:41:17 +02:00
parent f7b8b5c4fb
commit 36a4dbae4b

View File

@ -252,19 +252,20 @@ static int append_session_cg_weight(pam_handle_t *handle, sd_bus_message *m, con
uint64_t val; uint64_t val;
int r; int r;
if (!isempty(limit)) { if (isempty(limit))
r = cg_weight_parse(limit, &val); return 0;
if (r >= 0) {
r = sd_bus_message_append(m, "(sv)", field, "t", val); r = cg_weight_parse(limit, &val);
if (r < 0) { if (r >= 0) {
pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); r = sd_bus_message_append(m, "(sv)", field, "t", val);
return r; if (r < 0) {
} pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r));
} else if (streq(field, "CPUWeight")) return r;
pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.cpu_weight: %s, ignoring.", limit); }
else } else if (streq(field, "CPUWeight"))
pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.io_weight: %s, ignoring.", limit); pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.cpu_weight: %s, ignoring.", limit);
} else
pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.io_weight: %s, ignoring.", limit);
return 0; return 0;
} }