diff random.c @ 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 48e173a0c52b
children 73b6e5d8801b b07eb3dc23ec
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));