summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite/src/os_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_sqlite/sqlite/src/os_test.c')
-rw-r--r--ext/pdo_sqlite/sqlite/src/os_test.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/pdo_sqlite/sqlite/src/os_test.c b/ext/pdo_sqlite/sqlite/src/os_test.c
index 0e292bc428..8199f5b183 100644
--- a/ext/pdo_sqlite/sqlite/src/os_test.c
+++ b/ext/pdo_sqlite/sqlite/src/os_test.c
@@ -239,10 +239,12 @@ printf("Writing block %d of %s\n", i, pFile->zName);
if( BLOCK_OFFSET(i+1)>nMax ){
len = nMax-BLOCK_OFFSET(i);
}
- if( trash ){
- sqlite3Randomness(len, p);
+ if( len>0 ){
+ if( trash ){
+ sqlite3Randomness(len, p);
+ }
+ rc = sqlite3RealWrite(&pFile->fd, p, len);
}
- rc = sqlite3RealWrite(&pFile->fd, p, len);
}
sqliteFree(p);
}