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 | |
parent | dbef1173b00f0877a63121c40bf607155ac1e9a7 (diff) |
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')
-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) printf("USER TTY IDLE TIME HOST\n"); while ((ut = getutent()) != NULL) { if (ut->ut_user[0] && (opt || ut->ut_type == USER_PROCESS)) { + time_t tmp; /* ut->ut_line is device name of tty - "/dev/" */ name = concat_path_file("/dev", ut->ut_line); str6[0] = '?'; str6[1] = '\0'; if (stat(name, &st) == 0) idle_string(str6, st.st_atime); + /* manpages say ut_tv.tv_sec *is* time_t, + * but some systems have it wrong */ + tmp = ut->ut_tv.tv_sec; /* 15 chars for time: Nov 10 19:33:20 */ printf("%-10s %-8s %-9s %-15.15s %s\n", ut->ut_user, ut->ut_line, str6, - ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); + ctime(&tmp) + 4, ut->ut_host); if (ENABLE_FEATURE_CLEAN_UP) free(name); } |