Jelajahi Sumber

lost: use portable kamailio rand() wrapper instead of direct library call

Henning Westerholt 6 tahun lalu
induk
melakukan
6cc563b1b7
1 mengubah file dengan 3 tambahan dan 2 penghapusan
  1. 3 2
      src/modules/lost/utilities.c

+ 3 - 2
src/modules/lost/utilities.c

@@ -45,6 +45,7 @@
 #include "../../core/dprint.h"
 #include "../../core/mem/mem.h"
 #include "../../core/mem/shm_mem.h"
+#include "../../core/rand/kam_rand.h"
 
 #include "pidf.h"
 #include "utilities.h"
@@ -85,9 +86,9 @@ void lost_rand_str(char *dest, size_t lgth)
 	char charset[] = "0123456789"
 					 "abcdefghijklmnopqrstuvwxyz"
 					 "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-	srand(time(NULL));
+	kam_srand(time(NULL));
 	while(lgth-- > 0) {
-		index = (double)rand() / RAND_MAX * (sizeof charset - 1);
+		index = (double)kam_rand() / RAND_MAX * (sizeof charset - 1);
 		*dest++ = charset[index];
 	}
 	*dest = '\0';