mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Fixes to os_unix.c to support database (and other) files larger than 2GiB.
FossilOrigin-Name: e7fae33c0754488336ce093189a83dfe1b818d89
This commit is contained in:
17
manifest
17
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\sharmless\scompiler\swarning.
|
||||
D 2014-09-05T05:58:37.378
|
||||
C Fixes\sto\sos_unix.c\sto\ssupport\sdatabase\s(and\sother)\sfiles\slarger\sthan\s2GiB.
|
||||
D 2014-09-06T16:49:40.555
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -208,7 +208,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace
|
||||
F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c 8525ca79457c5b4673a5fda2774ee39fe155f40f
|
||||
F src/os_unix.c 22225d7969b3e4d7aaef9804ea5af5d02d7abd6a
|
||||
F src/os_win.c 3c9f7df710cb6c757b04b78bf3d98f03830e67b9
|
||||
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
|
||||
F src/pager.c 3e732d2bbdd8d8d95fed0c5ae7e718d73153c4c5
|
||||
@@ -1193,7 +1193,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 9779c7a9eb1e2bd36e9286331a9314f064014d80
|
||||
R 05490459da8c4172c4abbda0933bfe68
|
||||
U mistachkin
|
||||
Z b93a43f7e285c77b049b454cce5380d9
|
||||
P 733119067757814609a9cea6b975818607bee4e3
|
||||
R da7850c1d5c67f21c676f6a6ed44959c
|
||||
T *branch * android-large-filles
|
||||
T *sym-android-large-filles *
|
||||
T -sym-trunk *
|
||||
U dan
|
||||
Z 5be16efe9db58eba68bedd24a6d0231c
|
||||
|
||||
@@ -1 +1 @@
|
||||
733119067757814609a9cea6b975818607bee4e3
|
||||
e7fae33c0754488336ce093189a83dfe1b818d89
|
||||
@@ -299,6 +299,14 @@ static int randomnessPid = 0;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek()
|
||||
** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined.
|
||||
*/
|
||||
#ifdef __ANDROID__
|
||||
# define lseek lseek64
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Different Unix systems declare open() in different ways. Same use
|
||||
** open(const char*,int,mode_t). Others use open(const char*,int,...).
|
||||
@@ -708,9 +716,22 @@ static int lockTrace(int fd, int op, struct flock *p){
|
||||
|
||||
/*
|
||||
** Retry ftruncate() calls that fail due to EINTR
|
||||
**
|
||||
** All calls to ftruncate() within this file should be made through this wrapper.
|
||||
** On the Android platform, bypassing the logic below could lead to a corrupt
|
||||
** database.
|
||||
*/
|
||||
static int robust_ftruncate(int h, sqlite3_int64 sz){
|
||||
int rc;
|
||||
#ifdef __ANDROID__
|
||||
/* On Android, ftruncate() always uses 32-bit offsets, even if
|
||||
** _FILE_OFFSET_BITS=64 is defined. This means it is unsafe to attempt to
|
||||
** truncate a file to any size smaller than 2GiB. Silently ignore any
|
||||
** such attempts. */
|
||||
if( sz>(sqlite3_int64)0x7FFFFFFF ){
|
||||
rc = SQLITE_OK;
|
||||
}else
|
||||
#endif
|
||||
do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );
|
||||
return rc;
|
||||
}
|
||||
@@ -3595,7 +3616,7 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
|
||||
nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
|
||||
}
|
||||
|
||||
rc = robust_ftruncate(pFile->h, (off_t)nByte);
|
||||
rc = robust_ftruncate(pFile->h, nByte);
|
||||
if( rc ){
|
||||
pFile->lastErrno = errno;
|
||||
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
|
||||
|
||||
Reference in New Issue
Block a user