From c4c623ae05ffb5db8fcb1e71fd675e7694d89939 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 26 Mar 2000 19:47:59 +0000 Subject: [PATCH] (make_fileinfo): make sure to always call time, ctime, and gmtime with `time_t's. there were some types (like in lastlog) that we believed to always be time_t. this has proven wrong on Solaris 8 in 64-bit mode, where they are stored as 32-bit quantities but time_t has gone up to 64 bits git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8067 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftpd/ls.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/appl/ftp/ftpd/ls.c b/appl/ftp/ftpd/ls.c index 872b0f90f..6b2a6fc04 100644 --- a/appl/ftp/ftpd/ls.c +++ b/appl/ftp/ftpd/ls.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -177,9 +177,10 @@ make_fileinfo(const char *filename, struct fileinfo *file, int flags) { time_t t = time(NULL); - struct tm *tm = localtime(&st->st_mtime); - if((t - st->st_mtime > 6*30*24*60*60) || - (st->st_mtime - t > 6*30*24*60*60)) + time_t st_mtime = st->st_mtime; + struct tm *tm = localtime(&st_mtime); + if((t - st_mtime > 6*30*24*60*60) || + (st_mtime - t > 6*30*24*60*60)) strftime(buf, sizeof(buf), "%b %e %Y", tm); else strftime(buf, sizeof(buf), "%b %e %H:%M", tm);