diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-09 09:50:33 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-09 09:50:33 +0000 |
commit | f62ab2d77455ca42e1300e72b70d06e8a16db53b (patch) | |
tree | 7a5391066d647ecec698214773eee8504c7a041a /coreutils/who.c | |
parent | dbef1173b00f0877a63121c40bf607155ac1e9a7 (diff) | |
download | busybox-w32-f62ab2d77455ca42e1300e72b70d06e8a16db53b.tar.gz busybox-w32-f62ab2d77455ca42e1300e72b70d06e8a16db53b.tar.bz2 busybox-w32-f62ab2d77455ca42e1300e72b70d06e8a16db53b.zip |
libbb: use improved xmalloc_read() from modprobe-small
who: fix compile breakage on some systems
modprobe-small: improve Config help text wording
Diffstat (limited to 'coreutils/who.c')
-rw-r--r-- | coreutils/who.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/coreutils/who.c b/coreutils/who.c index a4ec740f0..baf526b01 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -56,16 +56,20 @@ int who_main(int argc UNUSED_PARAM, char **argv) | |||
56 | printf("USER TTY IDLE TIME HOST\n"); | 56 | printf("USER TTY IDLE TIME HOST\n"); |
57 | while ((ut = getutent()) != NULL) { | 57 | while ((ut = getutent()) != NULL) { |
58 | if (ut->ut_user[0] && (opt || ut->ut_type == USER_PROCESS)) { | 58 | if (ut->ut_user[0] && (opt || ut->ut_type == USER_PROCESS)) { |
59 | time_t tmp; | ||
59 | /* ut->ut_line is device name of tty - "/dev/" */ | 60 | /* ut->ut_line is device name of tty - "/dev/" */ |
60 | name = concat_path_file("/dev", ut->ut_line); | 61 | name = concat_path_file("/dev", ut->ut_line); |
61 | str6[0] = '?'; | 62 | str6[0] = '?'; |
62 | str6[1] = '\0'; | 63 | str6[1] = '\0'; |
63 | if (stat(name, &st) == 0) | 64 | if (stat(name, &st) == 0) |
64 | idle_string(str6, st.st_atime); | 65 | idle_string(str6, st.st_atime); |
66 | /* manpages say ut_tv.tv_sec *is* time_t, | ||
67 | * but some systems have it wrong */ | ||
68 | tmp = ut->ut_tv.tv_sec; | ||
65 | /* 15 chars for time: Nov 10 19:33:20 */ | 69 | /* 15 chars for time: Nov 10 19:33:20 */ |
66 | printf("%-10s %-8s %-9s %-15.15s %s\n", | 70 | printf("%-10s %-8s %-9s %-15.15s %s\n", |
67 | ut->ut_user, ut->ut_line, str6, | 71 | ut->ut_user, ut->ut_line, str6, |
68 | ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); | 72 | ctime(&tmp) + 4, ut->ut_host); |
69 | if (ENABLE_FEATURE_CLEAN_UP) | 73 | if (ENABLE_FEATURE_CLEAN_UP) |
70 | free(name); | 74 | free(name); |
71 | } | 75 | } |