summaryrefslogtreecommitdiff
path: root/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c')
-rw-r--r--lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c b/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c
new file mode 100644
index 00000000000..6f9770d387e
--- /dev/null
+++ b/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c
@@ -0,0 +1,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 */
+