diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-09-06 13:22:32 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-09-06 13:54:15 +0200 |
commit | 98dc726902eed6755fd087eb9b18f60228293efb (patch) | |
tree | a6c6aee960c04a04ff1b3fff66ab27619028f165 /src/test/test-utmp.c | |
parent | tree-wide: drop unnecessary utmp includes (diff) | |
download | systemd-98dc726902eed6755fd087eb9b18f60228293efb.tar.xz systemd-98dc726902eed6755fd087eb9b18f60228293efb.zip |
test-utmp: replace UT_LINESIZE/UT_NAMESIZE/UT_HOSTSIZE with sizeof_field()
utmpx doesn't know these defines, hence fix them.
Diffstat (limited to '')
-rw-r--r-- | src/test/test-utmp.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/test/test-utmp.c b/src/test/test-utmp.c index 06a0fce764..e94ee03250 100644 --- a/src/test/test-utmp.c +++ b/src/test/test-utmp.c @@ -7,15 +7,9 @@ #include "utmp-wtmp.h" #include "tests.h" -#ifndef UT_LINESIZE -# define UT_LINESIZE 32 -#endif -#ifndef UT_NAMESIZE -# define UT_NAMESIZE 32 -#endif -#ifndef UT_HOSTSIZE -# define UT_HOSTSIZE 256 -#endif +#define UTX_LINESIZE sizeof_field(struct utmpx, ut_line) +#define UTX_NAMESIZE sizeof_field(struct utmpx, ut_user) +#define UTX_HOSTSIZE sizeof_field(struct utmpx, ut_host) TEST(dump_run_utmp) { _unused_ _cleanup_(utxent_cleanup) bool utmpx = false; @@ -46,11 +40,11 @@ TEST(dump_run_utmp) { log_info("%14s %10"PID_PRI" line=%-7.*s id=%-4.4s name=%-8.*s session=%lu host=%.*s addr=%s", type, u->ut_pid, - UT_LINESIZE, u->ut_line, + (int) UTX_LINESIZE, u->ut_line, u->ut_id, - UT_NAMESIZE, u->ut_user, + (int) UTX_NAMESIZE, u->ut_user, (long unsigned) u->ut_session, - UT_HOSTSIZE, u->ut_host, + (int) UTX_HOSTSIZE, u->ut_host, IN_ADDR_TO_STRING(is_ipv4 ? AF_INET : AF_INET6, &addr)); } } |