This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
The following commit(s) were added to refs/heads/master by this push:
new 3d9162b sanlock: fix the lack of random_r in musl
3d9162b is described below
commit 3d9162b699c3aa27f87a46b72bfc27ff6ec50e65
Author: Hongxu Jia <hongxu.jia(a)windriver.com>
AuthorDate: Wed Oct 17 15:10:57 2018 -0500
sanlock: fix the lack of random_r in musl
Signed-off-by: Hongxu Jia <hongxu.jia(a)windriver.com>
---
src/main.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/main.c b/src/main.c
index b1aa023..7a62b1d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -84,7 +84,6 @@ static char command[COMMAND_MAX];
static int cmd_argc;
static char **cmd_argv;
static struct thread_pool pool;
-static struct random_data rand_data;
static char rand_state[32];
static pthread_mutex_t rand_mutex = PTHREAD_MUTEX_INITIALIZER;
static const char *run_dir = NULL;
@@ -1386,16 +1385,15 @@ int get_rand(int a, int b);
int get_rand(int a, int b)
{
- int32_t val;
- int rv;
+ long int rv;
pthread_mutex_lock(&rand_mutex);
- rv = random_r(&rand_data, &val);
+ rv = random();
pthread_mutex_unlock(&rand_mutex);
if (rv < 0)
return rv;
- 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 */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.