@@ -1,8 +1,8 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 - * Jonathan Schleifer + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 + * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -228,23 +228,27 @@ #ifdef HAVE_OBJC_ENUMERATIONMUTATION objc_setEnumerationMutationHandler(enumerationMutationHandler); #endif + of_hash_seed = 0; + while (of_hash_seed == 0) { #if defined(HAVE_ARC4RANDOM) - of_hash_seed = arc4random(); + of_hash_seed = arc4random(); #elif defined(HAVE_RANDOM) - struct timeval t; - gettimeofday(&t, NULL); - srandom((unsigned)(t.tv_sec ^ t.tv_usec)); - of_hash_seed = (uint32_t)((random() << 16) | (random() & 0xFFFF)); + struct timeval t; + gettimeofday(&t, NULL); + srandom((unsigned)(t.tv_sec ^ t.tv_usec)); + of_hash_seed = (uint32_t)((random() << 16) | + (random() & 0xFFFF)); #else - struct timeval t; - gettimeofday(&t, NULL); - srand((unsigned)(t.tv_sec ^ t.tv_usec)); - of_hash_seed = (uint32_t)((rand() << 16) | (rand() & 0xFFFF)); + struct timeval t; + gettimeofday(&t, NULL); + srand((unsigned)(t.tv_sec ^ t.tv_usec)); + of_hash_seed = (uint32_t)((rand() << 16) | (rand() & 0xFFFF)); #endif + } } + (void)unload { }