diff options
-rw-r--r-- | coreutils/who.c | 8 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | init/halt.c | 4 | ||||
-rw-r--r-- | libbb/utmp.c | 44 | ||||
-rw-r--r-- | miscutils/last.c | 8 | ||||
-rw-r--r-- | miscutils/last_fancy.c | 16 | ||||
-rw-r--r-- | miscutils/runlevel.c | 12 | ||||
-rw-r--r-- | miscutils/wall.c | 8 | ||||
-rw-r--r-- | procps/uptime.c | 6 |
9 files changed, 56 insertions, 52 deletions
diff --git a/coreutils/who.c b/coreutils/who.c index f955ce6d3..8337212c9 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -73,7 +73,7 @@ static void idle_string(char *str6, time_t t) | |||
73 | int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 73 | int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
74 | int who_main(int argc UNUSED_PARAM, char **argv) | 74 | int who_main(int argc UNUSED_PARAM, char **argv) |
75 | { | 75 | { |
76 | struct utmp *ut; | 76 | struct utmpx *ut; |
77 | unsigned opt; | 77 | unsigned opt; |
78 | int do_users = (ENABLE_USERS && (!ENABLE_WHO || applet_name[0] == 'u')); | 78 | int do_users = (ENABLE_USERS && (!ENABLE_WHO || applet_name[0] == 'u')); |
79 | const char *fmt = "%s"; | 79 | const char *fmt = "%s"; |
@@ -83,8 +83,8 @@ int who_main(int argc UNUSED_PARAM, char **argv) | |||
83 | if (opt & 2) // -H | 83 | if (opt & 2) // -H |
84 | printf("USER\t\tTTY\t\tIDLE\tTIME\t\t HOST\n"); | 84 | printf("USER\t\tTTY\t\tIDLE\tTIME\t\t HOST\n"); |
85 | 85 | ||
86 | setutent(); | 86 | setutxent(); |
87 | while ((ut = getutent()) != NULL) { | 87 | while ((ut = getutxent()) != NULL) { |
88 | if (ut->ut_user[0] | 88 | if (ut->ut_user[0] |
89 | && ((opt & 1) || ut->ut_type == USER_PROCESS) | 89 | && ((opt & 1) || ut->ut_type == USER_PROCESS) |
90 | ) { | 90 | ) { |
@@ -126,6 +126,6 @@ int who_main(int argc UNUSED_PARAM, char **argv) | |||
126 | if (do_users) | 126 | if (do_users) |
127 | bb_putchar('\n'); | 127 | bb_putchar('\n'); |
128 | if (ENABLE_FEATURE_CLEAN_UP) | 128 | if (ENABLE_FEATURE_CLEAN_UP) |
129 | endutent(); | 129 | endutxent(); |
130 | return EXIT_SUCCESS; | 130 | return EXIT_SUCCESS; |
131 | } | 131 | } |
diff --git a/include/libbb.h b/include/libbb.h index 26b686805..0f8363b78 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -84,7 +84,7 @@ | |||
84 | # include <selinux/av_permissions.h> | 84 | # include <selinux/av_permissions.h> |
85 | #endif | 85 | #endif |
86 | #if ENABLE_FEATURE_UTMP | 86 | #if ENABLE_FEATURE_UTMP |
87 | # include <utmp.h> | 87 | # include <utmpx.h> |
88 | #endif | 88 | #endif |
89 | #if ENABLE_LOCALE_SUPPORT | 89 | #if ENABLE_LOCALE_SUPPORT |
90 | # include <locale.h> | 90 | # include <locale.h> |
diff --git a/init/halt.c b/init/halt.c index 7974adb17..ad12d9148 100644 --- a/init/halt.c +++ b/init/halt.c | |||
@@ -74,7 +74,7 @@ | |||
74 | 74 | ||
75 | static void write_wtmp(void) | 75 | static void write_wtmp(void) |
76 | { | 76 | { |
77 | struct utmp utmp; | 77 | struct utmpx utmp; |
78 | struct utsname uts; | 78 | struct utsname uts; |
79 | /* "man utmp" says wtmp file should *not* be created automagically */ | 79 | /* "man utmp" says wtmp file should *not* be created automagically */ |
80 | /*if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) { | 80 | /*if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) { |
@@ -88,7 +88,7 @@ static void write_wtmp(void) | |||
88 | utmp.ut_line[0] = '~'; utmp.ut_line[1] = '~'; /* = strcpy(utmp.ut_line, "~~"); */ | 88 | utmp.ut_line[0] = '~'; utmp.ut_line[1] = '~'; /* = strcpy(utmp.ut_line, "~~"); */ |
89 | uname(&uts); | 89 | uname(&uts); |
90 | safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host)); | 90 | safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host)); |
91 | updwtmp(bb_path_wtmp_file, &utmp); | 91 | updwtmpx(bb_path_wtmp_file, &utmp); |
92 | } | 92 | } |
93 | #else | 93 | #else |
94 | #define write_wtmp() ((void)0) | 94 | #define write_wtmp() ((void)0) |
diff --git a/libbb/utmp.c b/libbb/utmp.c index 8ad9ba27e..bd07670db 100644 --- a/libbb/utmp.c +++ b/libbb/utmp.c | |||
@@ -16,7 +16,7 @@ static void touch(const char *filename) | |||
16 | 16 | ||
17 | void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname) | 17 | void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname) |
18 | { | 18 | { |
19 | struct utmp utent; | 19 | struct utmpx utent; |
20 | char *id; | 20 | char *id; |
21 | unsigned width; | 21 | unsigned width; |
22 | 22 | ||
@@ -45,17 +45,17 @@ void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, con | |||
45 | tty_name += 3; | 45 | tty_name += 3; |
46 | strncpy(id, tty_name, width); | 46 | strncpy(id, tty_name, width); |
47 | 47 | ||
48 | touch(_PATH_UTMP); | 48 | touch(_PATH_UTMPX); |
49 | //utmpname(_PATH_UTMP); | 49 | //utmpxname(_PATH_UTMPX); |
50 | setutent(); | 50 | setutxent(); |
51 | /* Append new one (hopefully, unless we collide on ut_id) */ | 51 | /* Append new one (hopefully, unless we collide on ut_id) */ |
52 | pututline(&utent); | 52 | pututxline(&utent); |
53 | endutent(); | 53 | endutxent(); |
54 | 54 | ||
55 | #if ENABLE_FEATURE_WTMP | 55 | #if ENABLE_FEATURE_WTMP |
56 | /* "man utmp" says wtmp file should *not* be created automagically */ | 56 | /* "man utmp" says wtmp file should *not* be created automagically */ |
57 | /*touch(bb_path_wtmp_file);*/ | 57 | /*touch(bb_path_wtmp_file);*/ |
58 | updwtmp(bb_path_wtmp_file, &utent); | 58 | updwtmpx(bb_path_wtmp_file, &utent); |
59 | #endif | 59 | #endif |
60 | } | 60 | } |
61 | 61 | ||
@@ -64,17 +64,17 @@ void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, con | |||
64 | */ | 64 | */ |
65 | void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname) | 65 | void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname) |
66 | { | 66 | { |
67 | struct utmp utent; | 67 | struct utmpx utent; |
68 | struct utmp *utp; | 68 | struct utmpx *utp; |
69 | 69 | ||
70 | touch(_PATH_UTMP); | 70 | touch(_PATH_UTMPX); |
71 | //utmpname(_PATH_UTMP); | 71 | //utmpxname(_PATH_UTMPX); |
72 | setutent(); | 72 | setutxent(); |
73 | 73 | ||
74 | /* Did init/getty/telnetd/sshd/... create an entry for us? | 74 | /* Did init/getty/telnetd/sshd/... create an entry for us? |
75 | * It should be (new_type-1), but we'd also reuse | 75 | * It should be (new_type-1), but we'd also reuse |
76 | * any other potentially stale xxx_PROCESS entry */ | 76 | * any other potentially stale xxx_PROCESS entry */ |
77 | while ((utp = getutent()) != NULL) { | 77 | while ((utp = getutxent()) != NULL) { |
78 | if (utp->ut_pid == pid | 78 | if (utp->ut_pid == pid |
79 | // && ut->ut_line[0] | 79 | // && ut->ut_line[0] |
80 | && utp->ut_id[0] /* must have nonzero id */ | 80 | && utp->ut_id[0] /* must have nonzero id */ |
@@ -88,25 +88,25 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const | |||
88 | /* Stale record. Nuke hostname */ | 88 | /* Stale record. Nuke hostname */ |
89 | memset(utp->ut_host, 0, sizeof(utp->ut_host)); | 89 | memset(utp->ut_host, 0, sizeof(utp->ut_host)); |
90 | } | 90 | } |
91 | /* NB: pututline (see later) searches for matching utent | 91 | /* NB: pututxline (see later) searches for matching utxent |
92 | * using getutid(utent) - we must not change ut_id | 92 | * using getutxid(utent) - we must not change ut_id |
93 | * if we want *exactly this* record to be overwritten! | 93 | * if we want *exactly this* record to be overwritten! |
94 | */ | 94 | */ |
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | //endutent(); - no need, pututline can deal with (and actually likes) | 98 | //endutxent(); - no need, pututxline can deal with (and actually likes) |
99 | //the situation when utmp file is positioned on found record | 99 | //the situation when utmp file is positioned on found record |
100 | 100 | ||
101 | if (!utp) { | 101 | if (!utp) { |
102 | if (new_type != DEAD_PROCESS) | 102 | if (new_type != DEAD_PROCESS) |
103 | write_new_utmp(pid, new_type, tty_name, username, hostname); | 103 | write_new_utmp(pid, new_type, tty_name, username, hostname); |
104 | else | 104 | else |
105 | endutent(); | 105 | endutxent(); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | 108 | ||
109 | /* Make a copy. We can't use *utp, pututline's internal getutid | 109 | /* Make a copy. We can't use *utp, pututxline's internal getutxid |
110 | * will overwrite it before it is used! */ | 110 | * will overwrite it before it is used! */ |
111 | utent = *utp; | 111 | utent = *utp; |
112 | 112 | ||
@@ -120,14 +120,14 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const | |||
120 | utent.ut_tv.tv_sec = time(NULL); | 120 | utent.ut_tv.tv_sec = time(NULL); |
121 | 121 | ||
122 | /* Update, or append new one */ | 122 | /* Update, or append new one */ |
123 | //setutent(); | 123 | //setutxent(); |
124 | pututline(&utent); | 124 | pututxline(&utent); |
125 | endutent(); | 125 | endutxent(); |
126 | 126 | ||
127 | #if ENABLE_FEATURE_WTMP | 127 | #if ENABLE_FEATURE_WTMP |
128 | /* "man utmp" says wtmp file should *not* be created automagically */ | 128 | /* "man utmp" says wtmp file should *not* be created automagically */ |
129 | /*touch(bb_path_wtmp_file);*/ | 129 | /*touch(bb_path_wtmp_file);*/ |
130 | updwtmp(bb_path_wtmp_file, &utent); | 130 | updwtmpx(bb_path_wtmp_file, &utent); |
131 | #endif | 131 | #endif |
132 | } | 132 | } |
133 | 133 | ||
diff --git a/miscutils/last.c b/miscutils/last.c index a144c7e47..6d8b58463 100644 --- a/miscutils/last.c +++ b/miscutils/last.c | |||
@@ -32,21 +32,21 @@ | |||
32 | 32 | ||
33 | #if defined UT_LINESIZE \ | 33 | #if defined UT_LINESIZE \ |
34 | && ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256)) | 34 | && ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256)) |
35 | #error struct utmp member char[] size(s) have changed! | 35 | #error struct utmpx member char[] size(s) have changed! |
36 | #elif defined __UT_LINESIZE \ | 36 | #elif defined __UT_LINESIZE \ |
37 | && ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256)) | 37 | && ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256)) |
38 | #error struct utmp member char[] size(s) have changed! | 38 | #error struct utmpx member char[] size(s) have changed! |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \ | 41 | #if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \ |
42 | OLD_TIME != 4 | 42 | OLD_TIME != 4 |
43 | #error Values for the ut_type field of struct utmp changed | 43 | #error Values for the ut_type field of struct utmpx changed |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 46 | int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
47 | int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | 47 | int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
48 | { | 48 | { |
49 | struct utmp ut; | 49 | struct utmpx ut; |
50 | int n, file = STDIN_FILENO; | 50 | int n, file = STDIN_FILENO; |
51 | time_t t_tmp; | 51 | time_t t_tmp; |
52 | off_t pos; | 52 | off_t pos; |
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c index 16ed9e920..8194e31b5 100644 --- a/miscutils/last_fancy.c +++ b/miscutils/last_fancy.c | |||
@@ -22,6 +22,10 @@ | |||
22 | #define HEADER_LINE_WIDE "USER", "TTY", \ | 22 | #define HEADER_LINE_WIDE "USER", "TTY", \ |
23 | INET6_ADDRSTRLEN, INET6_ADDRSTRLEN, "HOST", "LOGIN", " TIME", "" | 23 | INET6_ADDRSTRLEN, INET6_ADDRSTRLEN, "HOST", "LOGIN", " TIME", "" |
24 | 24 | ||
25 | #if !defined __UT_LINESIZE && defined UT_LINESIZE | ||
26 | # define __UT_LINESIZE UT_LINESIZE | ||
27 | #endif | ||
28 | |||
25 | enum { | 29 | enum { |
26 | NORMAL, | 30 | NORMAL, |
27 | LOGGED, | 31 | LOGGED, |
@@ -39,7 +43,7 @@ enum { | |||
39 | 43 | ||
40 | #define show_wide (option_mask32 & LAST_OPT_W) | 44 | #define show_wide (option_mask32 & LAST_OPT_W) |
41 | 45 | ||
42 | static void show_entry(struct utmp *ut, int state, time_t dur_secs) | 46 | static void show_entry(struct utmpx *ut, int state, time_t dur_secs) |
43 | { | 47 | { |
44 | unsigned days, hours, mins; | 48 | unsigned days, hours, mins; |
45 | char duration[sizeof("(%u+02:02)") + sizeof(int)*3]; | 49 | char duration[sizeof("(%u+02:02)") + sizeof(int)*3]; |
@@ -104,7 +108,7 @@ static void show_entry(struct utmp *ut, int state, time_t dur_secs) | |||
104 | duration_str); | 108 | duration_str); |
105 | } | 109 | } |
106 | 110 | ||
107 | static int get_ut_type(struct utmp *ut) | 111 | static int get_ut_type(struct utmpx *ut) |
108 | { | 112 | { |
109 | if (ut->ut_line[0] == '~') { | 113 | if (ut->ut_line[0] == '~') { |
110 | if (strcmp(ut->ut_user, "shutdown") == 0) { | 114 | if (strcmp(ut->ut_user, "shutdown") == 0) { |
@@ -142,7 +146,7 @@ static int get_ut_type(struct utmp *ut) | |||
142 | return ut->ut_type; | 146 | return ut->ut_type; |
143 | } | 147 | } |
144 | 148 | ||
145 | static int is_runlevel_shutdown(struct utmp *ut) | 149 | static int is_runlevel_shutdown(struct utmpx *ut) |
146 | { | 150 | { |
147 | if (((ut->ut_pid & 255) == '0') || ((ut->ut_pid & 255) == '6')) { | 151 | if (((ut->ut_pid & 255) == '0') || ((ut->ut_pid & 255) == '6')) { |
148 | return 1; | 152 | return 1; |
@@ -154,7 +158,7 @@ static int is_runlevel_shutdown(struct utmp *ut) | |||
154 | int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 158 | int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
155 | int last_main(int argc UNUSED_PARAM, char **argv) | 159 | int last_main(int argc UNUSED_PARAM, char **argv) |
156 | { | 160 | { |
157 | struct utmp ut; | 161 | struct utmpx ut; |
158 | const char *filename = _PATH_WTMP; | 162 | const char *filename = _PATH_WTMP; |
159 | llist_t *zlist; | 163 | llist_t *zlist; |
160 | off_t pos; | 164 | off_t pos; |
@@ -242,9 +246,9 @@ int last_main(int argc UNUSED_PARAM, char **argv) | |||
242 | { | 246 | { |
243 | llist_t *el, *next; | 247 | llist_t *el, *next; |
244 | for (el = zlist; el; el = next) { | 248 | for (el = zlist; el; el = next) { |
245 | struct utmp *up = (struct utmp *)el->data; | 249 | struct utmpx *up = (struct utmpx *)el->data; |
246 | next = el->link; | 250 | next = el->link; |
247 | if (strncmp(up->ut_line, ut.ut_line, UT_LINESIZE) == 0) { | 251 | if (strncmp(up->ut_line, ut.ut_line, __UT_LINESIZE) == 0) { |
248 | if (show) { | 252 | if (show) { |
249 | show_entry(&ut, NORMAL, up->ut_tv.tv_sec); | 253 | show_entry(&ut, NORMAL, up->ut_tv.tv_sec); |
250 | show = 0; | 254 | show = 0; |
diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c index 76231df22..8558db862 100644 --- a/miscutils/runlevel.c +++ b/miscutils/runlevel.c | |||
@@ -29,19 +29,19 @@ | |||
29 | int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 29 | int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
30 | int runlevel_main(int argc UNUSED_PARAM, char **argv) | 30 | int runlevel_main(int argc UNUSED_PARAM, char **argv) |
31 | { | 31 | { |
32 | struct utmp *ut; | 32 | struct utmpx *ut; |
33 | char prev; | 33 | char prev; |
34 | 34 | ||
35 | if (argv[1]) utmpname(argv[1]); | 35 | if (argv[1]) utmpxname(argv[1]); |
36 | 36 | ||
37 | setutent(); | 37 | setutxent(); |
38 | while ((ut = getutent()) != NULL) { | 38 | while ((ut = getutxent()) != NULL) { |
39 | if (ut->ut_type == RUN_LVL) { | 39 | if (ut->ut_type == RUN_LVL) { |
40 | prev = ut->ut_pid / 256; | 40 | prev = ut->ut_pid / 256; |
41 | if (prev == 0) prev = 'N'; | 41 | if (prev == 0) prev = 'N'; |
42 | printf("%c %c\n", prev, ut->ut_pid % 256); | 42 | printf("%c %c\n", prev, ut->ut_pid % 256); |
43 | if (ENABLE_FEATURE_CLEAN_UP) | 43 | if (ENABLE_FEATURE_CLEAN_UP) |
44 | endutent(); | 44 | endutxent(); |
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | } | 47 | } |
@@ -49,6 +49,6 @@ int runlevel_main(int argc UNUSED_PARAM, char **argv) | |||
49 | puts("unknown"); | 49 | puts("unknown"); |
50 | 50 | ||
51 | if (ENABLE_FEATURE_CLEAN_UP) | 51 | if (ENABLE_FEATURE_CLEAN_UP) |
52 | endutent(); | 52 | endutxent(); |
53 | return 1; | 53 | return 1; |
54 | } | 54 | } |
diff --git a/miscutils/wall.c b/miscutils/wall.c index bb709ee39..50658f457 100644 --- a/miscutils/wall.c +++ b/miscutils/wall.c | |||
@@ -32,7 +32,7 @@ | |||
32 | int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 32 | int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
33 | int wall_main(int argc UNUSED_PARAM, char **argv) | 33 | int wall_main(int argc UNUSED_PARAM, char **argv) |
34 | { | 34 | { |
35 | struct utmp *ut; | 35 | struct utmpx *ut; |
36 | char *msg; | 36 | char *msg; |
37 | int fd; | 37 | int fd; |
38 | 38 | ||
@@ -46,8 +46,8 @@ int wall_main(int argc UNUSED_PARAM, char **argv) | |||
46 | msg = xmalloc_read(fd, NULL); | 46 | msg = xmalloc_read(fd, NULL); |
47 | if (ENABLE_FEATURE_CLEAN_UP && argv[1]) | 47 | if (ENABLE_FEATURE_CLEAN_UP && argv[1]) |
48 | close(fd); | 48 | close(fd); |
49 | setutent(); | 49 | setutxent(); |
50 | while ((ut = getutent()) != NULL) { | 50 | while ((ut = getutxent()) != NULL) { |
51 | char *line; | 51 | char *line; |
52 | if (ut->ut_type != USER_PROCESS) | 52 | if (ut->ut_type != USER_PROCESS) |
53 | continue; | 53 | continue; |
@@ -56,7 +56,7 @@ int wall_main(int argc UNUSED_PARAM, char **argv) | |||
56 | free(line); | 56 | free(line); |
57 | } | 57 | } |
58 | if (ENABLE_FEATURE_CLEAN_UP) { | 58 | if (ENABLE_FEATURE_CLEAN_UP) { |
59 | endutent(); | 59 | endutxent(); |
60 | free(msg); | 60 | free(msg); |
61 | } | 61 | } |
62 | return EXIT_SUCCESS; | 62 | return EXIT_SUCCESS; |
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) | |||
81 | 81 | ||
82 | #if ENABLE_FEATURE_UPTIME_UTMP_SUPPORT | 82 | #if ENABLE_FEATURE_UPTIME_UTMP_SUPPORT |
83 | { | 83 | { |
84 | struct utmp *ut; | 84 | struct utmpx *ut; |
85 | unsigned users = 0; | 85 | unsigned users = 0; |
86 | while ((ut = getutent()) != NULL) { | 86 | while ((ut = getutxent()) != NULL) { |
87 | if ((ut->ut_type == USER_PROCESS) && (ut->ut_name[0] != '\0')) | 87 | if ((ut->ut_type == USER_PROCESS) && (ut->ut_user[0] != '\0')) |
88 | users++; | 88 | users++; |
89 | } | 89 | } |
90 | printf(", %u users", users); | 90 | printf(", %u users", users); |