[modify for coverity scan]

This commit is contained in:
Hui Li 2020-06-18 16:01:06 +08:00
parent 4f6973d6ec
commit bee2818b5a
1 changed files with 4 additions and 5 deletions

View File

@ -37,7 +37,7 @@ int taosRand(void)
int taosRand(void)
{
int fd;
unsigned long seed;
int seed;
fd = open("/dev/urandom", 0);
if (fd < 0) {
@ -46,12 +46,11 @@ int taosRand(void)
int len = read(fd, &seed, sizeof(seed));
if (len < 0) {
seed = time(0);
}
srand(seed);
}
close(fd);
}
return rand();
return seed;
}
#endif