]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/: Use SYSLOGE() instead of SYSLOG() with %m
authorAlejandro Colomar <alx@kernel.org>
Sat, 11 Jul 2026 22:16:59 +0000 (00:16 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 17 Jul 2026 13:48:04 +0000 (08:48 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/failure.c
lib/log.c
lib/utmp.c

index 107c526a336515c197fc38f8101d8f14717098a8..c8a4ea069b84d2a7a147f98955720341e9440eff 100644 (file)
@@ -18,6 +18,7 @@
 #include "defines.h"
 #include "faillog.h"
 #include "failure.h"
+#include "io/syslog.h"
 #include "prototypes.h"
 #include "string/memset/memzero.h"
 #include "string/strftime.h"
@@ -46,9 +47,9 @@ 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: %m",
-                      (unsigned long) uid, FAILLOG_FILE);
+               SYSLOGE(LOG_WARN,
+                       "Can't write faillog entry for UID %lu in %s",
+                       (unsigned long) uid, FAILLOG_FILE);
                return;
        }
 
@@ -109,9 +110,9 @@ err_write:
                errno = saved_errno;
        }
 err_close:
-       SYSLOG(LOG_WARN,
-              "Can't write faillog entry for UID %lu to %s: %m",
-              (unsigned long) uid, FAILLOG_FILE);
+       SYSLOGE(LOG_WARN,
+               "Can't write faillog entry for UID %lu to %s",
+               (unsigned long) uid, FAILLOG_FILE);
 }
 
 static bool too_many_failures (const struct faillog *fl)
@@ -162,10 +163,10 @@ 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: %m; "
-                      "User access authorized.",
-                      FAILLOG_FILE, (unsigned long) uid);
+               SYSLOGE(LOG_WARN,
+                       "User access authorized; "
+                       "can't open the faillog file (%s) to check UID %lu",
+                       FAILLOG_FILE, (unsigned long) uid);
                return 1;
        }
 
@@ -224,9 +225,9 @@ err_write:
                errno = saved_errno;
        }
 err_close:
-       SYSLOG(LOG_WARN,
-              "Can't reset faillog entry for UID %lu in %s: %m",
-              (unsigned long) uid, FAILLOG_FILE);
+       SYSLOGE(LOG_WARN,
+               "Can't reset faillog entry for UID %lu in %s",
+               (unsigned long) uid, FAILLOG_FILE);
        return 1;
 }
 
index 52abbead166142758fb6dd082a03fe00ffbd5f4a..37dbabfbcaa31bcbebd8f868167cfbbb3b535f99 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -18,6 +18,7 @@
 
 #include "attr.h"
 #include "defines.h"
+#include "io/syslog.h"
 #include "prototypes.h"
 #include "string/memset/memzero.h"
 #include "string/strcpy/strncpy.h"
@@ -104,7 +105,7 @@ err_write:
                errno = saved_errno;
        }
 err_close:
-       SYSLOG(LOG_WARN,
-              "Can't write lastlog entry for UID %lu in %s: %m",
-              (unsigned long) pw->pw_uid, _PATH_LASTLOG);
+       SYSLOGE(LOG_WARN,
+               "Can't write lastlog entry for UID %lu in %s",
+               (unsigned long) pw->pw_uid, _PATH_LASTLOG);
 }
index dc9870a7cff703e949d66e8cc2343af8b3a06c49..62002768e61676cb436397a7210d9d43f3a5ffc8 100644 (file)
@@ -29,6 +29,7 @@
 #include "alloc/calloc.h"
 #include "alloc/malloc.h"
 #include "attr.h"
+#include "io/syslog.h"
 #include "sizeof.h"
 #include "string/strchr/strnul.h"
 #include "string/strcmp/streq.h"
@@ -102,9 +103,9 @@ failtmp(const char *username, const struct utmpx *failent)
        fd = open (ftmp, O_WRONLY | O_APPEND);
        if (-1 == fd) {
                if (errno != ENOENT) {
-                       SYSLOG(LOG_WARN,
-                              "Can't append failure of user %s to %s: %m",
-                              username, ftmp);
+                       SYSLOGE(LOG_WARN,
+                               "Can't append failure of user %s to %s",
+                               username, ftmp);
                }
                return;
        }
@@ -130,7 +131,7 @@ err_write:
                errno = saved_errno;
        }
 err_close:
-       SYSLOG(LOG_WARN, "Can't append failure of user %s to %s: %m", username, ftmp);
+       SYSLOGE(LOG_WARN, "Can't append failure of user %s to %s", username, ftmp);
 }