diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-07-10 14:57:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-10 14:57:14 +0200 |
commit | ba40f0399e506194fd21bb0a6c8d57e306116d20 (patch) | |
tree | 44e33fc543086460a640d781bc6e79b7cbe53ea9 /src/login | |
parent | systemctl: allow "cat" on units with bad settings (diff) | |
parent | firewall-util: use fixed size array for chain name (diff) | |
download | systemd-ba40f0399e506194fd21bb0a6c8d57e306116d20.tar.xz systemd-ba40f0399e506194fd21bb0a6c8d57e306116d20.zip |
Merge pull request #12939 from yuwata/lgtm-fixes
make LGTM quiet
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/logind-seat.c | 3 | ||||
-rw-r--r-- | src/login/pam_systemd.c | 27 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index dc578adf63..c3ad5f9b5b 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -9,6 +9,7 @@ #include "sd-messages.h" #include "alloc-util.h" +#include "errno-util.h" #include "fd-util.h" #include "fileio.h" #include "format-util.h" @@ -377,7 +378,7 @@ int seat_read_active_vt(Seat *s) { k = read(s->manager->console_active_fd, t, sizeof(t)-1); if (k <= 0) { - log_error("Failed to read current console: %s", k < 0 ? strerror(errno) : "EOF"); + log_error("Failed to read current console: %s", k < 0 ? strerror_safe(errno) : "EOF"); return k < 0 ? -errno : -EIO; } diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index cd070329f4..3f762cbbc3 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -21,6 +21,7 @@ #include "bus-internal.h" #include "bus-util.h" #include "cgroup-util.h" +#include "errno-util.h" #include "fd-util.h" #include "fileio.h" #include "format-util.h" @@ -251,7 +252,7 @@ static int append_session_memory_max(pam_handle_t *handle, sd_bus_message *m, co if (streq(limit, "infinity")) { r = sd_bus_message_append(m, "(sv)", "MemoryMax", "t", (uint64_t)-1); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror_safe(r)); return r; } } else { @@ -259,7 +260,7 @@ static int append_session_memory_max(pam_handle_t *handle, sd_bus_message *m, co if (r >= 0) { r = sd_bus_message_append(m, "(sv)", "MemoryMaxScale", "u", (uint32_t) (((uint64_t) r * UINT32_MAX) / 1000U)); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror_safe(r)); return r; } } else { @@ -267,7 +268,7 @@ static int append_session_memory_max(pam_handle_t *handle, sd_bus_message *m, co if (r >= 0) { r = sd_bus_message_append(m, "(sv)", "MemoryMax", "t", val); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror_safe(r)); return r; } } else @@ -290,7 +291,7 @@ static int append_session_tasks_max(pam_handle_t *handle, sd_bus_message *m, con if (r >= 0) { r = sd_bus_message_append(m, "(sv)", "TasksMax", "t", val); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror_safe(r)); return r; } } else @@ -310,7 +311,7 @@ static int append_session_cg_weight(pam_handle_t *handle, sd_bus_message *m, con if (r >= 0) { r = sd_bus_message_append(m, "(sv)", field, "t", val); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror_safe(r)); return r; } } else if (streq(field, "CPUWeight")) @@ -375,7 +376,7 @@ static bool validate_runtime_directory(pam_handle_t *handle, const char *path, u * up properly for us. */ if (lstat(path, &st) < 0) { - pam_syslog(handle, LOG_ERR, "Failed to stat() runtime directory '%s': %s", path, strerror(errno)); + pam_syslog(handle, LOG_ERR, "Failed to stat() runtime directory '%s': %s", path, strerror_safe(errno)); goto fail; } @@ -549,7 +550,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( r = sd_bus_open_system(&bus); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", strerror_safe(r)); return PAM_SESSION_ERR; } @@ -574,7 +575,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( "org.freedesktop.login1.Manager", "CreateSession"); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to create CreateSession method call: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to create CreateSession method call: %s", strerror_safe(r)); return PAM_SESSION_ERR; } @@ -593,13 +594,13 @@ _public_ PAM_EXTERN int pam_sm_open_session( remote_user, remote_host); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror_safe(r)); return PAM_SESSION_ERR; } r = sd_bus_message_open_container(m, 'a', "(sv)"); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to open message container: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to open message container: %s", strerror_safe(r)); return PAM_SYSTEM_ERR; } @@ -621,7 +622,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( r = sd_bus_message_close_container(m); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to close message container: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to close message container: %s", strerror_safe(r)); return PAM_SYSTEM_ERR; } @@ -648,7 +649,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( &vtnr, &existing); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to parse message: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to parse message: %s", strerror_safe(r)); return PAM_SESSION_ERR; } @@ -759,7 +760,7 @@ _public_ PAM_EXTERN int pam_sm_close_session( r = sd_bus_open_system(&bus); if (r < 0) { - pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", strerror(-r)); + pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", strerror_safe(r)); return PAM_SESSION_ERR; } |