]> granicus.if.org Git - strace/commitdiff
Fix printing of time_t values set in the distant future
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 8 Jan 2015 15:08:16 +0000 (15:08 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 8 Jan 2015 15:34:43 +0000 (15:34 +0000)
* util.c (sprinttime): Increase buffer size.
* tests/stat64-v.test: Try to set modification time of the sample file
to a value set in the distant future.

tests/stat64-v.test
util.c

index 7e08e2586e7af4df45a76e1e0e77aa89b635790e..c7ebf49cf9dfd2b24ae886abcae9fe575639bf84 100755 (executable)
@@ -22,6 +22,7 @@ $truncate_cmd > "$OUT" 2>&1 || {
 ./stat $sample > /dev/null ||
        fail_ 'stat failed'
 
+touch -d '1970-01-01 36028797018963968 seconds' $sample ||
 touch -t 0102030405 $sample
 
 for f in $sample . /dev/null; do
diff --git a/util.c b/util.c
index b7476cf281b3a967038a59f39451335d9358f51f..570888c8685dc749cc29606f6c6189637465263c 100644 (file)
--- a/util.c
+++ b/util.c
@@ -425,7 +425,7 @@ const char *
 sprinttime(time_t t)
 {
        struct tm *tmp;
-       static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
+       static char buf[sizeof(int) * 3 * 6];
 
        if (t == 0) {
                strcpy(buf, "0");