# HG changeset patch # User Matt Johnston # Date 1363872214 -28800 # Node ID 84157e435c5298e2bc1e44ad3aa2eb9a31f9113a # Parent e22d5f5f6e371b436c0cd9418fc00466e77b7088 Make sure "struct timeval" is initialised on OS X to avoid valgrind warnings diff -r e22d5f5f6e37 -r 84157e435c52 random.c --- 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));