diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2023-11-10 21:20:08 +0100 |
---|---|---|
committer | Dmitry V. Levin <github.dl@altlinux.org> | 2023-11-12 16:28:06 +0000 |
commit | 9952e5fb5cce0e9d040729edfbc296b26b66b49a (patch) | |
tree | 79f8b743221df6a91a6aeffac5724471440e870e /libpam/pam_env.c | |
parent | bfd2a786edc79d7ae4b49ca04e32181c382d5cef (diff) | |
download | pam-9952e5fb5cce0e9d040729edfbc296b26b66b49a.tar.gz pam-9952e5fb5cce0e9d040729edfbc296b26b66b49a.tar.bz2 pam-9952e5fb5cce0e9d040729edfbc296b26b66b49a.zip |
libpam: improve debug output
The debug output of environment variables tries to properly format
pointers in a right-aligned way. 9 characters are not enough for
32 bit pointers though due to prepended 0x. Also, it takes 18 for
64 bit systems.
Adjust the formatter properly for architectures.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'libpam/pam_env.c')
-rw-r--r-- | libpam/pam_env.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpam/pam_env.c b/libpam/pam_env.c index 002aed62..4357b657 100644 --- a/libpam/pam_env.c +++ b/libpam/pam_env.c @@ -14,6 +14,7 @@ #include "pam_inline.h" #include <string.h> +#include <stdint.h> #include <stdlib.h> #ifdef sunos @@ -33,7 +34,12 @@ static void _pam_dump_env(pam_handle_t *pamh) , pamh->env->requested, pamh->env->entries)); for (i=0; i<pamh->env->requested; ++i) { - _pam_output_debug(">%-3d [%9p]:[%s]" + _pam_output_debug( +#if UINTPTR_MAX == UINT32_MAX + ">%-3d [%10p]:[%s]" +#else + ">%-3d [%18p]:[%s]" +#endif , i, pamh->env->list[i], pamh->env->list[i]); } _pam_output_debug("*NOTE* the last item should be (nil)"); |