From 8ebf6707cf6716c55d68e2ba7e62ef820c590050 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 6 Feb 2007 11:11:08 +0000 Subject: [PATCH] Check the return value of lseek() in os_unix.c to make sure it really worked. (CVS 3628) FossilOrigin-Name: e4408dd1fd32e6c5057cce0fdfa70eb2d9bd2531 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 12 ++++++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 24ac1557b6..41eff4fa22 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Set\sthe\sMEM_Term\sflag\swhen\san\sinternal\sstring\shas\sa\snul-terminator\sappended\sto\sit.\sFix\sfor\s#2213.\s(CVS\s3627) -D 2007-02-05T14:21:48 +C Check\sthe\sreturn\svalue\sof\slseek()\sin\sos_unix.c\sto\smake\ssure\sit\sreally\sworked.\s(CVS\s3628) +D 2007-02-06T11:11:08 F Makefile.in 7fa74bf4359aa899da5586e394d17735f221315f F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -81,7 +81,7 @@ F src/os_os2.c 8ee8207fe218a1acf3a31d59753e165e5c23bb95 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 -F src/os_unix.c 09d422370948fb5087a2873ac81470ef2f943559 +F src/os_unix.c 2f7f7dbb95bbfa109f951c828b248102ab75b621 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_win.c 8736cf3a49fd651a6538857480f302807d57814c F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b @@ -429,7 +429,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 9740aa95a3f848fc663c88263a911fbc76ada243 -R d73700830796fc2d1a889a0e4c3150c2 -U danielk1977 -Z 35f14111d159ab5ad3822621311305ca +P fc969ad991e5114c3612f4796e342a6db2d79cd5 +R 6df56c6ecba71e85197c64417671afce +U drh +Z 5bd5ca139750741850fce483a9880960 diff --git a/manifest.uuid b/manifest.uuid index 4e89f43867..c5a71e63ec 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fc969ad991e5114c3612f4796e342a6db2d79cd5 \ No newline at end of file +e4408dd1fd32e6c5057cce0fdfa70eb2d9bd2531 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index c5fa2c0ed0..8ac272e5e2 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1000,10 +1000,14 @@ int sqlite3UnixIsDirWritable(char *zBuf){ */ static int seekAndRead(unixFile *id, void *pBuf, int cnt){ int got; + i64 newOffset; #ifdef USE_PREAD got = pread(id->h, pBuf, cnt, id->offset); #else - lseek(id->h, id->offset, SEEK_SET); + newOffset = lseek(id->h, id->offset, SEEK_SET); + if( newOffset!=id->offset ){ + return -1; + } got = read(id->h, pBuf, cnt); #endif if( got>0 ){ @@ -1043,10 +1047,14 @@ static int unixRead(OsFile *id, void *pBuf, int amt){ */ static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){ int got; + i64 newOffset; #ifdef USE_PREAD got = pwrite(id->h, pBuf, cnt, id->offset); #else - lseek(id->h, id->offset, SEEK_SET); + newOffset = lseek(id->h, id->offset, SEEK_SET); + if( newOffset!=id->offset ){ + return -1; + } got = write(id->h, pBuf, cnt); #endif if( got>0 ){ -- 2.47.2