mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
- guenther@cvs.openbsd.org 2014/01/09 03:26:00
[sftp-common.c] When formating the time for "ls -l"-style output, show dates in the future with the year, and rearrange a comparison to avoid a potentional signed arithmetic overflow that would give the wrong result. ok djm@
This commit is contained in:
parent
3e49853650
commit
e00e413dd1
@ -3,6 +3,12 @@
|
|||||||
- tedu@cvs.openbsd.org 2014/01/04 17:50:55
|
- tedu@cvs.openbsd.org 2014/01/04 17:50:55
|
||||||
[mac.c monitor_mm.c monitor_mm.h xmalloc.c]
|
[mac.c monitor_mm.c monitor_mm.h xmalloc.c]
|
||||||
use standard types and formats for size_t like variables. ok dtucker
|
use standard types and formats for size_t like variables. ok dtucker
|
||||||
|
- guenther@cvs.openbsd.org 2014/01/09 03:26:00
|
||||||
|
[sftp-common.c]
|
||||||
|
When formating the time for "ls -l"-style output, show dates in the future
|
||||||
|
with the year, and rearrange a comparison to avoid a potentional signed
|
||||||
|
arithmetic overflow that would give the wrong result.
|
||||||
|
ok djm@
|
||||||
|
|
||||||
20140108
|
20140108
|
||||||
- (djm) [regress/.cvsignore] Ignore regress test droppings; ok dtucker@
|
- (djm) [regress/.cvsignore] Ignore regress test droppings; ok dtucker@
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sftp-common.c,v 1.25 2013/11/08 11:15:19 dtucker Exp $ */
|
/* $OpenBSD: sftp-common.c,v 1.26 2014/01/09 03:26:00 guenther Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Markus Friedl. All rights reserved.
|
* Copyright (c) 2001 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2001 Damien Miller. All rights reserved.
|
* Copyright (c) 2001 Damien Miller. All rights reserved.
|
||||||
@ -195,6 +195,7 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units)
|
|||||||
char *user, *group;
|
char *user, *group;
|
||||||
char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1];
|
char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1];
|
||||||
char sbuf[FMT_SCALED_STRSIZE];
|
char sbuf[FMT_SCALED_STRSIZE];
|
||||||
|
time_t now;
|
||||||
|
|
||||||
strmode(st->st_mode, mode);
|
strmode(st->st_mode, mode);
|
||||||
if (!remote) {
|
if (!remote) {
|
||||||
@ -210,7 +211,9 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units)
|
|||||||
group = gbuf;
|
group = gbuf;
|
||||||
}
|
}
|
||||||
if (ltime != NULL) {
|
if (ltime != NULL) {
|
||||||
if (time(NULL) - st->st_mtime < (365*24*60*60)/2)
|
now = time(NULL);
|
||||||
|
if (now - (365*24*60*60)/2 < st->st_mtime &&
|
||||||
|
now >= st->st_mtime)
|
||||||
sz = strftime(tbuf, sizeof tbuf, "%b %e %H:%M", ltime);
|
sz = strftime(tbuf, sizeof tbuf, "%b %e %H:%M", ltime);
|
||||||
else
|
else
|
||||||
sz = strftime(tbuf, sizeof tbuf, "%b %e %Y", ltime);
|
sz = strftime(tbuf, sizeof tbuf, "%b %e %Y", ltime);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user