summaryrefslogtreecommitdiffstats
path: root/src/test/test-utmp.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/test-utmp.c18
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));
}
}