1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix an important bug in the handling of EINTR in unixRead(). Never came

up on x86 but crashes on sparc.

FossilOrigin-Name: 1a16db0bca717a2582a48332d81854ca90d6d49b
This commit is contained in:
drh
2012-02-10 03:10:27 +00:00
parent bb8c1b5e63
commit c18b40462b
3 changed files with 9 additions and 9 deletions

View File

@@ -5413,7 +5413,7 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
memset(zBuf, 0, nBuf);
#if !defined(SQLITE_TEST)
{
int pid, fd;
int pid, fd, got;
fd = robust_open("/dev/urandom", O_RDONLY, 0);
if( fd<0 ){
time_t t;
@@ -5424,7 +5424,7 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf );
nBuf = sizeof(t) + sizeof(pid);
}else{
do{ nBuf = osRead(fd, zBuf, nBuf); }while( nBuf<0 && errno==EINTR );
do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );
robust_close(0, fd, __LINE__);
}
}