From 86a7f18f211af1abda5c855d2674b0fcb53de524 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 2 Apr 2015 23:03:46 +0200 Subject: *: Switch to POSIX utmpx API UTMP is SVID legacy, UTMPX is mandated by POSIX. Glibc and uClibc have identical layout of UTMP and UTMPX, both of these libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing changes except the names of the API entrypoints. Signed-off-by: Bernhard Reutner-Fischer --- procps/uptime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'procps/uptime.c') diff --git a/procps/uptime.c b/procps/uptime.c index 778812a6f..149bae6e5 100644 --- a/procps/uptime.c +++ b/procps/uptime.c @@ -81,10 +81,10 @@ int uptime_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) #if ENABLE_FEATURE_UPTIME_UTMP_SUPPORT { - struct utmp *ut; + struct utmpx *ut; unsigned users = 0; - while ((ut = getutent()) != NULL) { - if ((ut->ut_type == USER_PROCESS) && (ut->ut_name[0] != '\0')) + while ((ut = getutxent()) != NULL) { + if ((ut->ut_type == USER_PROCESS) && (ut->ut_user[0] != '\0')) users++; } printf(", %u users", users); -- cgit v1.2.3