Code

Now using utmpx instead of utmp in users.c to be POSIX 1003.1-2001 compliant.
authortokkee <tokkee>
Sun, 4 Dec 2005 18:23:19 +0000 (18:23 +0000)
committertokkee <tokkee>
Sun, 4 Dec 2005 18:23:19 +0000 (18:23 +0000)
src/users.c

index f2808dd943ed630e36c9cff501e29b09a50cabea..36cea0fb4b4618826cdb7e13af49f4f1b9f6daca 100644 (file)
@@ -30,7 +30,7 @@
 #include "plugin.h"
 #include "common.h"
 
-#include <utmp.h>
+#include <utmpx.h>
 
 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;