From 7a260f01ce6841658810dc9f0ff0706558a10d7f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 19 Jun 2006 03:20:03 +0000 Subject: Make some 64 bit warnings go away on x86-64. --- coreutils/who.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'coreutils/who.c') diff --git a/coreutils/who.c b/coreutils/who.c index 0cb74313e..5cff65157 100644 --- a/coreutils/who.c +++ b/coreutils/who.c @@ -14,12 +14,9 @@ *---------------------------------------------------------------------- */ -#include -#include +#include "busybox.h" #include -#include #include -#include "busybox.h" static const char * idle_string (time_t t) { @@ -33,7 +30,7 @@ static const char * idle_string (time_t t) sprintf (str, "%02d:%02d", (int) (s / (60 * 60)), (int) ((s % (60 * 60)) / 60)); - return (const char *) str; + return str; } return "old"; } @@ -52,14 +49,16 @@ int who_main(int argc, char **argv) printf("USER TTY IDLE TIME HOST\n"); while ((ut = getutent()) != NULL) { if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { + time_t thyme = ut->ut_tv.tv_sec; + /* ut->ut_line is device name of tty - "/dev/" */ name = concat_path_file("/dev", ut->ut_line); printf("%-10s %-8s %-8s %-12.12s %s\n", ut->ut_user, ut->ut_line, (stat(name, &st)) ? "?" : idle_string(st.st_atime), - ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); - free(name); + ctime(&thyme) + 4, ut->ut_host); + if (ENABLE_FEATURE_CLEAN_UP) free(name); } } - endutent(); + if (ENABLE_FEATURE_CLEAN_UP) endutent(); return 0; } -- cgit v1.2.3