fix handle leak.

This commit is contained in:
5loyd 2015-11-25 16:40:50 +08:00
parent 62b4e109a5
commit feb0eee569

2
ph7.c
View File

@ -34900,10 +34900,12 @@ static sxi32 SyOSUtilRandomSeed(void *pBuf,sxu32 nLen,void *pUnused)
fd = open("/dev/urandom",O_RDONLY);
if (fd >= 0 ){
if( read(fd,zBuf,nLen) > 0 ){
close(fd);
return SXRET_OK;
}
/* FALL THRU */
}
close(fd);
pid = getpid();
SyMemcpy((const void *)&pid,zBuf,SXMIN(nLen,sizeof(pid_t)));
if( &zBuf[nLen] - &zBuf[sizeof(pid_t)] >= (int)sizeof(struct timeval) ){