diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-10 00:18:28 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-10 00:18:28 +0000 |
commit | 9a975a9faed7c4f334e8c8490db3e77e102f2b21 (patch) | |
tree | 764a885ec9a963f6a8b15de6e1765f16b9ac4738 /sftp-common.c | |
parent | ee196dab7c5f97f0b80c8099343a375bead92010 (diff) | |
parent | cdb6c90811caa5df2df856be9b0b16db020fe31d (diff) |
Import openssh_6.5p1.orig.tar.gz
Diffstat (limited to 'sftp-common.c')
-rw-r--r-- | sftp-common.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sftp-common.c b/sftp-common.c index 413efc209..70a929ccc 100644 --- a/sftp-common.c +++ b/sftp-common.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-common.c,v 1.24 2013/05/17 00:13:14 djm Exp $ */ | 1 | /* $OpenBSD: sftp-common.c,v 1.26 2014/01/09 03:26:00 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2001 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2001 Damien Miller. All rights reserved. |
@@ -33,6 +33,7 @@ | |||
33 | #include <grp.h> | 33 | #include <grp.h> |
34 | #include <pwd.h> | 34 | #include <pwd.h> |
35 | #include <stdio.h> | 35 | #include <stdio.h> |
36 | #include <stdlib.h> | ||
36 | #include <string.h> | 37 | #include <string.h> |
37 | #include <time.h> | 38 | #include <time.h> |
38 | #include <stdarg.h> | 39 | #include <stdarg.h> |
@@ -194,6 +195,7 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units) | |||
194 | char *user, *group; | 195 | char *user, *group; |
195 | char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; | 196 | char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; |
196 | char sbuf[FMT_SCALED_STRSIZE]; | 197 | char sbuf[FMT_SCALED_STRSIZE]; |
198 | time_t now; | ||
197 | 199 | ||
198 | strmode(st->st_mode, mode); | 200 | strmode(st->st_mode, mode); |
199 | if (!remote) { | 201 | if (!remote) { |
@@ -209,7 +211,9 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units) | |||
209 | group = gbuf; | 211 | group = gbuf; |
210 | } | 212 | } |
211 | if (ltime != NULL) { | 213 | if (ltime != NULL) { |
212 | if (time(NULL) - st->st_mtime < (365*24*60*60)/2) | 214 | now = time(NULL); |
215 | if (now - (365*24*60*60)/2 < st->st_mtime && | ||
216 | now >= st->st_mtime) | ||
213 | sz = strftime(tbuf, sizeof tbuf, "%b %e %H:%M", ltime); | 217 | sz = strftime(tbuf, sizeof tbuf, "%b %e %H:%M", ltime); |
214 | else | 218 | else |
215 | sz = strftime(tbuf, sizeof tbuf, "%b %e %Y", ltime); | 219 | sz = strftime(tbuf, sizeof tbuf, "%b %e %Y", ltime); |