From: tokkee Date: Sun, 4 Dec 2005 18:23:19 +0000 (+0000) Subject: Now using utmpx instead of utmp in users.c to be POSIX 1003.1-2001 compliant. X-Git-Tag: collectd-3.5.0~29 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=45ae66d1ad43708da953835b5dd30c1127d59019;p=collectd.git Now using utmpx instead of utmp in users.c to be POSIX 1003.1-2001 compliant. --- diff --git a/src/users.c b/src/users.c index f2808dd9..36cea0fb 100644 --- a/src/users.c +++ b/src/users.c @@ -30,7 +30,7 @@ #include "plugin.h" #include "common.h" -#include +#include static char *rrd_file = "users.rrd"; @@ -51,17 +51,16 @@ void users_init(void) void users_read(void) { unsigned int users = 0; - unsigned int root = 0; - struct utmp *entry = NULL; + struct utmpx *entry = NULL; /* according to the *utent(3) man page none of the functions sets errno in * case of an error, so we cannot do any error-checking here */ - setutent(); + setutxent(); - while (NULL != (entry = getutent())) + while (NULL != (entry = getutxent())) if (USER_PROCESS == entry->ut_type) ++users; - endutent(); + endutxent(); users_submit(users); return;