+ rv = random();
pthread_mutex_unlock(&rand_mutex);if (rv < 0)
return rv;
But random_r() is accessed only via get_rand, using a mutex, so it lookslike we can replace it with random.
But why not use random() only when random_r() is not available?
Nir
- return a + (int) (((float)(b - a + 1)) * val / (RAND_MAX+1.0));
+ return a + (int) (((float)(b - a + 1)) * rv / (RAND_MAX+1.0));
}
static void setup_host_name(void)
@@ -1405,9 +1403,7 @@ static void setup_host_name(void)
uuid_t uu;
memset(rand_state, 0, sizeof(rand_state));
- memset(&rand_data, 0, sizeof(rand_data));
-
- initstate_r(time(NULL), rand_state, sizeof(rand_state), &rand_data);
+ initstate(time(NULL), rand_state, sizeof(rand_state));
/* use host name from command line */
--
2.8.1
_______________________________________________
sanlock-devel mailing list -- sanlock-devel@lists.fedorahosted.org
To unsubscribe send an email to sanlock-devel-leave@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/sanlock-devel@lists.fedorahosted.org