From c8afe6ff845e3bed9abf83fe818503278373b344 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Sun, 7 May 2023 11:10:17 +1000 Subject: w: Fix musl UT_HOSTSIZE issue While musl has utmpx.h, their header file does not define all the values, especially __UT_HOSTSIZE and friends. Instead it just hard codes the sizes :/ This change will look for that definition specifically and if not found will include utmp.h too. Checked on Alpine 3.17 musl just makes these a stub so w doesn't work anyway. Signed-off-by: Craig Small --- NEWS | 1 + configure.ac | 10 ++++++++++ src/w.c | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a5578c2..b046a40 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ procps-ng-NEXT * top: bad command line arguments yield EXIT_FAILURE issue #273 * top: avoids keystroke induced '%Cpu' distortions * top: includes VM (guest) tics in 'system' overhead issue #274 + * w: Fix musl UT_HOSTSIZE issue procps-ng-4.0.3 --------------- diff --git a/configure.ac b/configure.ac index 629881a..e20a2c5 100644 --- a/configure.ac +++ b/configure.ac @@ -78,6 +78,16 @@ AC_TYPE_SSIZE_T AC_CHECK_MEMBERS([struct stat.st_rdev]) AC_CHECK_MEMBERS([siginfo_t.si_int], [], [], [[#include ]]) +dnl Needed for musl +if test "x$ac_cv_header_utmpx_h" = xyes +then : +AC_CHECK_DECLS([__UT_HOSTSIZE], + [AC_DEFINE([HAVE_UT_HOSTSIZE_IN_UTMPX], [1], + [Define if __UT_HOSTSIZE in utmpx.h])], + [], + [[#include ]]) +fi + dnl libtool LT_INIT diff --git a/src/w.c b/src/w.c index 80a867b..093cfbc 100644 --- a/src/w.c +++ b/src/w.c @@ -45,7 +45,10 @@ #include #include #ifdef HAVE_UTMPX_H -# include +#include +#ifndef HAVE_UT_HOSTSIZE_IN_UTMPX +#include +#endif #else # include #endif -- cgit v1.2.1