changeset 714:84157e435c52

Make sure "struct timeval" is initialised on OS X to avoid valgrind warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 21 Mar 2013 21:23:34 +0800
parents e22d5f5f6e37
children cd3d3c63d189
files random.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/random.c	Wed Mar 20 23:52:49 2013 +0800
+++ b/random.c	Thu Mar 21 21:23:34 2013 +0800
@@ -217,6 +217,9 @@
 	pid = getpid();
 	sha1_process(&hs, (void*)&pid, sizeof(pid));
 
+	// gettimeofday() doesn't completely fill out struct timeval on 
+	// OS X (10.8.3), avoid valgrind warnings by clearing it first
+	memset(&tv, 0x0, sizeof(tv));
 	gettimeofday(&tv, NULL);
 	sha1_process(&hs, (void*)&tv, sizeof(tv));