diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-11 12:19:14 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-11 12:19:14 +0000 |
commit | dee8587d9208e4ea5ba8f8bb73b555007529372e (patch) | |
tree | 303d21aeec9e3922e296ecc9041598a87a79b554 /coreutils/who.c | |
parent | f941306199d7cb00be68483169f202432a9a9a7d (diff) | |
download | busybox-w32-dee8587d9208e4ea5ba8f8bb73b555007529372e.tar.gz busybox-w32-dee8587d9208e4ea5ba8f8bb73b555007529372e.tar.bz2 busybox-w32-dee8587d9208e4ea5ba8f8bb73b555007529372e.zip |
Apply post-1.11.0 patches. Bump version to 1.11.1.
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 a206ec54b..72fc40453 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -56,16 +56,20 @@ int who_main(int argc ATTRIBUTE_UNUSED, 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 | } |