From 6178f5a3dfa53efa28d13ffd029f7afbdb2ba50e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 11 Dec 2023 17:21:25 +0100 Subject: [PATCH] lib/failure,utmp: update error messages Include errno description. --- lib/failure.c | 8 ++++---- lib/utmp.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/failure.c b/lib/failure.c index 8a196fd8c..cb22694ac 100644 --- a/lib/failure.c +++ b/lib/failure.c @@ -45,7 +45,7 @@ void failure (uid_t uid, const char *tty, struct faillog *fl) fd = open (FAILLOG_FILE, O_RDWR); if (fd < 0) { SYSLOG ((LOG_WARN, - "Can't write faillog entry for UID %lu in %s.", + "Can't write faillog entry for UID %lu in %s: %m", (unsigned long) uid, FAILLOG_FILE)); return; } @@ -93,7 +93,7 @@ void failure (uid_t uid, const char *tty, struct faillog *fl) || (write_full(fd, fl, sizeof *fl) == -1) || (close (fd) != 0)) { SYSLOG ((LOG_WARN, - "Can't write faillog entry for UID %lu in %s.", + "Can't write faillog entry for UID %lu in %s: %m", (unsigned long) uid, FAILLOG_FILE)); (void) close (fd); } @@ -148,7 +148,7 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed) fd = open (FAILLOG_FILE, failed?O_RDONLY:O_RDWR); if (fd < 0) { SYSLOG ((LOG_WARN, - "Can't open the faillog file (%s) to check UID %lu. " + "Can't open the faillog file (%s) to check UID %lu: %m; " "User access authorized.", FAILLOG_FILE, (unsigned long) uid)); return 1; @@ -192,7 +192,7 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed) || (write_full(fd, &fail, sizeof fail) == -1) || (close (fd) != 0)) { SYSLOG ((LOG_WARN, - "Can't reset faillog entry for UID %lu in %s.", + "Can't reset faillog entry for UID %lu in %s: %m", (unsigned long) uid, FAILLOG_FILE)); (void) close (fd); } diff --git a/lib/utmp.c b/lib/utmp.c index 6acd196f0..5ac5ecd6a 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -102,7 +102,7 @@ static void failtmp (const char *username, const struct utmp *failent) if ( (write_full(fd, failent, sizeof *failent) == -1) || (close (fd) != 0)) { SYSLOG ((LOG_WARN, - "Can't append failure of user %s to %s.", + "Can't append failure of user %s to %s: %m", username, ftmp)); (void) close (fd); } -- 2.47.2