]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/failure,utmp: update error messages
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 11 Dec 2023 16:21:25 +0000 (17:21 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 14 Dec 2023 13:40:40 +0000 (07:40 -0600)
Include errno description.

lib/failure.c
lib/utmp.c

index 8a196fd8cbec80f1b59cb2c1f92a169b11f546ef..cb22694ac631d7f0a0a7d8952c75cf2b74aaab8e 100644 (file)
@@ -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);
                }
index 6acd196f05c1570bceb296426f1643f60ef86078..5ac5ecd6aa2ec1f1cc7f9c37fbc0efe3210c243c 100644 (file)
@@ -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);
        }