fix handle leak.
This commit is contained in:
parent
62b4e109a5
commit
feb0eee569
2
ph7.c
2
ph7.c
@ -34900,10 +34900,12 @@ static sxi32 SyOSUtilRandomSeed(void *pBuf,sxu32 nLen,void *pUnused)
|
|||||||
fd = open("/dev/urandom",O_RDONLY);
|
fd = open("/dev/urandom",O_RDONLY);
|
||||||
if (fd >= 0 ){
|
if (fd >= 0 ){
|
||||||
if( read(fd,zBuf,nLen) > 0 ){
|
if( read(fd,zBuf,nLen) > 0 ){
|
||||||
|
close(fd);
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
}
|
}
|
||||||
/* FALL THRU */
|
/* FALL THRU */
|
||||||
}
|
}
|
||||||
|
close(fd);
|
||||||
pid = getpid();
|
pid = getpid();
|
||||||
SyMemcpy((const void *)&pid,zBuf,SXMIN(nLen,sizeof(pid_t)));
|
SyMemcpy((const void *)&pid,zBuf,SXMIN(nLen,sizeof(pid_t)));
|
||||||
if( &zBuf[nLen] - &zBuf[sizeof(pid_t)] >= (int)sizeof(struct timeval) ){
|
if( &zBuf[nLen] - &zBuf[sizeof(pid_t)] >= (int)sizeof(struct timeval) ){
|
||||||
|
Loading…
Reference in New Issue
Block a user