From c19fef417bd082b9321ea8f59a648193ec5ab736 Mon Sep 17 00:00:00 2001
From: Marcus Meissner <marcus@jet.franken.de>
Date: Mon, 18 Nov 2002 23:11:37 +0000
Subject: [PATCH] Fixed strict aliasing issue in __pthread_once and
 SetWaitableTimer.

---
 scheduler/pthread.c | 3 ++-
 scheduler/timer.c   | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scheduler/pthread.c b/scheduler/pthread.c
index a82d3b57800..7bf27f6723a 100644
--- a/scheduler/pthread.c
+++ b/scheduler/pthread.c
@@ -198,8 +198,9 @@ int pthread_attr_setschedparam(pthread_attr_t *attr,
 int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
 {
   static pthread_once_t the_once = PTHREAD_ONCE_INIT;
-  LONG once_now = *(LONG *)&the_once;
+  LONG once_now;
 
+  memcpy(&once_now,&the_once,sizeof(once_now));
   if (InterlockedCompareExchange((LONG*)once_control, once_now+1, once_now) == once_now)
     (*init_routine)();
   return 0;
diff --git a/scheduler/timer.c b/scheduler/timer.c
index 3fe9dff3abe..c3026e52960 100644
--- a/scheduler/timer.c
+++ b/scheduler/timer.c
@@ -147,7 +147,11 @@ BOOL WINAPI SetWaitableTimer( HANDLE handle, const LARGE_INTEGER *when, LONG per
         else
         {
             DWORD remainder;
-            req->sec  = DOSFS_FileTimeToUnixTime( (FILETIME *)&exp, &remainder );
+            FILETIME ft;
+
+            ft.dwLowDateTime	= exp.s.LowPart;
+            ft.dwHighDateTime	= exp.s.HighPart;
+            req->sec  = DOSFS_FileTimeToUnixTime( &ft, &remainder );
             req->usec = remainder / 10;  /* convert from 100-ns to us units */
         }
         req->handle   = handle;
-- 
GitLab