All of lore.kernel.org
 help / color / mirror / Atom feed
* Patches to fix Time_tToSystemTime and stat.c time_buf being uninitialized
@ 2016-09-19  3:29 Bruce Cran
  2016-09-19 14:28 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce Cran @ 2016-09-19  3:29 UTC (permalink / raw)
  To: fio

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

I've attached a couple of patches contributed by Josh Sinykin.

-- 
Bruce


[-- Attachment #2: 0001-Fix-garbage-characters-in-json-output-caused-by-time.patch --]
[-- Type: text/plain, Size: 704 bytes --]

From 2283b843f49513c3251e90dbf530962af70e5c62 Mon Sep 17 00:00:00 2001
From: Josh Sinykin <josh.sinykin@broadcom.com>
Date: Mon, 19 Sep 2016 04:25:02 +0100
Subject: [PATCH] Fix garbage characters in json output caused by time_buf
 being uninitialized

---
 stat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/stat.c b/stat.c
index 74c2686..c9148ad 100644
--- a/stat.c
+++ b/stat.c
@@ -669,6 +669,8 @@ static void show_thread_status_normal(struct thread_stat *ts,
 
 	if (!ddir_rw_sum(ts->io_bytes) && !ddir_rw_sum(ts->total_io_u))
 		return;
+		
+	memset(time_buf, 0, sizeof(time_buf));
 
 	time(&time_p);
 	os_ctime_r((const time_t *) &time_p, time_buf, sizeof(time_buf));
-- 
2.9.3.windows.2


[-- Attachment #3: 0001-Windows-fix-Time_tToSystemTime-function-to-be-64-bit.patch --]
[-- Type: text/plain, Size: 1266 bytes --]

From f16e4ba86753839f907ececce7684d60e8e3e2ca Mon Sep 17 00:00:00 2001
From: Josh Sinykin <josh.sinykin@broadcom.com>
Date: Mon, 19 Sep 2016 04:17:30 +0100
Subject: [PATCH] Windows: fix Time_tToSystemTime function to be 64-bit
 compliant

Use LONGLONG instead of LARGE_INTEGER to avoid problems on 64-bit
systems causing a crash.
---
 os/windows/posix.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/os/windows/posix.c b/os/windows/posix.c
index fd3d9ab..5830e4c 100755
--- a/os/windows/posix.c
+++ b/os/windows/posix.c
@@ -232,10 +232,12 @@ char *dlerror(void)
 /* Copied from http://blogs.msdn.com/b/joshpoley/archive/2007/12/19/date-time-formats-and-conversions.aspx */
 void Time_tToSystemTime(time_t dosTime, SYSTEMTIME *systemTime)
 {
-    LARGE_INTEGER jan1970FT;
-    LARGE_INTEGER utcFT;
-    jan1970FT.QuadPart = 116444736000000000LL; // january 1st 1970
-    utcFT.QuadPart = ((unsigned __int64)dosTime) * 10000000 + jan1970FT.QuadPart;
+    FILETIME utcFT;
+    LONGLONG jan1970;
+
+    jan1970 = Int32x32To64(dosTime, 10000000) + 116444736000000000;
+    utcFT.dwLowDateTime = (DWORD)jan1970;
+    utcFT.dwHighDateTime = jan1970 >> 32;
 
     FileTimeToSystemTime((FILETIME*)&utcFT, systemTime);
 }
-- 
2.9.3.windows.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Patches to fix Time_tToSystemTime and stat.c time_buf being uninitialized
  2016-09-19  3:29 Patches to fix Time_tToSystemTime and stat.c time_buf being uninitialized Bruce Cran
@ 2016-09-19 14:28 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2016-09-19 14:28 UTC (permalink / raw)
  To: Bruce Cran, fio

On 09/18/2016 09:29 PM, Bruce Cran wrote:
> I've attached a couple of patches contributed by Josh Sinykin.

Thanks, committed.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-19 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19  3:29 Patches to fix Time_tToSystemTime and stat.c time_buf being uninitialized Bruce Cran
2016-09-19 14:28 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.