[modify for coverity scan]
This commit is contained in:
parent
4f6973d6ec
commit
bee2818b5a
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue