aboutsummaryrefslogtreecommitdiff
path: root/coreutils/who.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-04-02 23:03:46 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-04-02 23:03:46 +0200
commit86a7f18f211af1abda5c855d2674b0fcb53de524 (patch)
tree9fd1eadb83bf48b29e9468ea8ff0e43c0736c245 /coreutils/who.c
parent1186894f773e13ab9ca2b3e05a194e9b88796fbe (diff)
downloadbusybox-w32-86a7f18f211af1abda5c855d2674b0fcb53de524.tar.gz
busybox-w32-86a7f18f211af1abda5c855d2674b0fcb53de524.tar.bz2
busybox-w32-86a7f18f211af1abda5c855d2674b0fcb53de524.zip
*: 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 <rep.dot.nop@gmail.com>
Diffstat (limited to 'coreutils/who.c')
-rw-r--r--coreutils/who.c8
1 files changed, 4 insertions, 4 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)
73int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 73int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
74int who_main(int argc UNUSED_PARAM, char **argv) 74int 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}