summaryrefslogtreecommitdiff
path: root/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c
blob: 6f9770d387eac1917f1cb428aa2d17fee64489d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$NetBSD: patch-src_runtime_kernel_unix-timers.c,v 1.1 2016/04/14 21:58:22 dholland Exp $

Don't blithely assume that some internal type has the same layout as a
system type. It doesn't. Same issue as PR 40954, but a new case that I
either didn't find at the time or has appeared since.

--- src/runtime/kernel/unix-timers.c~	2000-06-01 18:34:03.000000000 +0000
+++ src/runtime/kernel/unix-timers.c
@@ -18,7 +18,7 @@ typedef struct rusage time_struct_t;
 #define GET_TIME(t)		getrusage(RUSAGE_SELF, &(t))
 #define SYS_TIME(t)		((t).ru_stime)
 #define USR_TIME(t)		((t).ru_utime)
-#define SET_TIME(tp, t)		{ *((struct timeval *)(tp)) = (t); }
+#define SET_TIME(tp, t)		{ (tp)->seconds = (t).tv_sec; (tp)->uSeconds = (t).tv_usec; }
 
 #else /* !HAS_GETRUSAGE */