提交 bee2818b 编写于 作者: H Hui Li

[modify for coverity scan]

上级 4f6973d6
...@@ -37,7 +37,7 @@ int taosRand(void) ...@@ -37,7 +37,7 @@ int taosRand(void)
int taosRand(void) int taosRand(void)
{ {
int fd; int fd;
unsigned long seed; int seed;
fd = open("/dev/urandom", 0); fd = open("/dev/urandom", 0);
if (fd < 0) { if (fd < 0) {
...@@ -46,12 +46,11 @@ int taosRand(void) ...@@ -46,12 +46,11 @@ int taosRand(void)
int len = read(fd, &seed, sizeof(seed)); int len = read(fd, &seed, sizeof(seed));
if (len < 0) { if (len < 0) {
seed = time(0); seed = time(0);
} }
srand(seed);
close(fd); close(fd);
} }
return rand(); return seed;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册