]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pam-util: make pam_debug_syslog_errno() returns pam error
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 21 Nov 2025 00:21:25 +0000 (09:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 22 Nov 2025 00:42:41 +0000 (09:42 +0900)
Currently, the result of pam_debug_syslog_errno() is unused, hence this
does not change anything and may be slightly redundant. But let's follow
our usual coding style.

src/shared/pam-util.h

index 9c5f2f37995cfc46174746477ad8b2e6e6333380..85f912556376072b6807fc97fb9947af17efed0b 100644 (file)
@@ -47,8 +47,10 @@ int pam_syslog_pam_error(pam_handle_t *handle, int level, int error, const char
 /* Call pam_syslog_errno if debug is enabled */
 #define pam_debug_syslog_errno(handle, debug, error, fmt, ...)          \
         ({                                                              \
-                if (debug)                                              \
-                        pam_syslog_errno(handle, LOG_DEBUG, error, fmt, ## __VA_ARGS__); \
+                int _error = (error);                                   \
+                debug ?                                                 \
+                        pam_syslog_errno(handle, LOG_DEBUG, _error, fmt, ## __VA_ARGS__) : \
+                        errno_to_pam_error(_error);                     \
         })
 
 static inline int pam_log_oom(pam_handle_t *handle) {