summaryrefslogtreecommitdiff
path: root/system/procps/utmpx.patch
blob: c4af55ede5ddd5f5a00b03b3e3809da1a94c299f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- procps-v4.0.5/library/uptime.c.old	2024-12-18 18:41:10.000000000 -0600
+++ procps-v4.0.5/library/uptime.c	2025-06-16 03:14:07.898014940 -0500
@@ -30,7 +30,11 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#else
 #include <utmp.h>
+#endif
 #ifdef WITH_SYSTEMD
 #include <systemd/sd-daemon.h>
 #include <systemd/sd-login.h>
@@ -63,7 +67,7 @@
 PROCPS_EXPORT int procps_users(void)
 {
     int numuser = 0;
-#ifdef HAVE_UTMP_X
+#ifdef HAVE_UTMPX_H
     struct utmpx *ut;
 #else
     struct utmp *ut;
@@ -99,7 +103,7 @@
     }
 #endif
 
-#ifdef HAVE_UTMP_X
+#ifdef HAVE_UTMPX_H
     setutxent();
     while ((ut = getutxent())) {
 #else
@@ -109,7 +113,11 @@
         if ((ut->ut_type == USER_PROCESS) && (ut->ut_name[0] != '\0'))
             numuser++;
     }
+#ifdef HAVE_UTMPX_H
+    endutxent();
+#else
     endutent();
+#endif
 
     return numuser;
 }