Fossil SCM

Update the built-in SQLite version to the latest from trunk, including the patch that sets -wal and -shm files to have the same owner as the database when running as root. That patch help to avoid configuration problems on Fossil servers.

drh 2012-02-11 21:23 trunk
Commit 5ac8c0d7132acd58daa92806998b08fe2be01552
2 files changed +51 -14 +1 -1
+51 -14
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -657,11 +657,11 @@
657657
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
658658
** [sqlite_version()] and [sqlite_source_id()].
659659
*/
660660
#define SQLITE_VERSION "3.7.11"
661661
#define SQLITE_VERSION_NUMBER 3007011
662
-#define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
662
+#define SQLITE_SOURCE_ID "2012-02-11 21:21:17 b022547389a40930cf0d2a75f5eb293acc9fbfe0"
663663
664664
/*
665665
** CAPI3REF: Run-Time Library Version Numbers
666666
** KEYWORDS: sqlite3_version, sqlite3_sourceid
667667
**
@@ -15216,13 +15216,15 @@
1521615216
*/
1521715217
#define SQLITE_MALLOC(x) malloc(x)
1521815218
#define SQLITE_FREE(x) free(x)
1521915219
#define SQLITE_REALLOC(x,y) realloc((x),(y))
1522015220
15221
+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE)
15222
+# include <malloc.h> /* Needed for malloc_usable_size on linux */
15223
+#endif
1522115224
#ifdef HAVE_MALLOC_USABLE_SIZE
1522215225
# ifndef SQLITE_MALLOCSIZE
15223
-# include <malloc.h>
1522415226
# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
1522515227
# endif
1522615228
#else
1522715229
# undef SQLITE_MALLOCSIZE
1522815230
#endif
@@ -24970,11 +24972,11 @@
2497024972
sqlite3_io_methods const *pMethod; /* Always the first entry */
2497124973
sqlite3_vfs *pVfs; /* The VFS that created this unixFile */
2497224974
unixInodeInfo *pInode; /* Info about locks on this inode */
2497324975
int h; /* The file descriptor */
2497424976
unsigned char eFileLock; /* The type of lock held on this fd */
24975
- unsigned char ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
24977
+ unsigned short int ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
2497624978
int lastErrno; /* The unix errno from last I/O error */
2497724979
void *lockingContext; /* Locking style specific state */
2497824980
UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */
2497924981
const char *zPath; /* Name of the file */
2498024982
unixShm *pShm; /* Shared memory segment information */
@@ -25021,10 +25023,11 @@
2502125023
#endif
2502225024
#define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
2502325025
#define UNIXFILE_DELETE 0x20 /* Delete on close */
2502425026
#define UNIXFILE_URI 0x40 /* Filename might have query parameters */
2502525027
#define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
25028
+#define UNIXFILE_CHOWN 0x100 /* File ownership was changed */
2502625029
2502725030
/*
2502825031
** Include code that is common to all os_*.c files
2502925032
*/
2503025033
/************** Include os_common.h in the middle of os_unix.c ***************/
@@ -28868,14 +28871,23 @@
2886828871
openFlags = O_RDONLY;
2886928872
pShmNode->isReadonly = 1;
2887028873
}
2887128874
pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777));
2887228875
if( pShmNode->h<0 ){
28873
- if( pShmNode->h<0 ){
28874
- rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename);
28875
- goto shm_open_err;
28876
- }
28876
+ rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename);
28877
+ goto shm_open_err;
28878
+ }
28879
+
28880
+ /* If this process is running as root, make sure that the SHM file
28881
+ ** is owned by the same user that owns the original database. Otherwise,
28882
+ ** the original owner will not be able to connect. If this process is
28883
+ ** not root, the following fchown() will fail, but we don't care. The
28884
+ ** if(){..} and the UNIXFILE_CHOWN flag are purely to silence compiler
28885
+ ** warnings.
28886
+ */
28887
+ if( fchown(pShmNode->h, sStat.st_uid, sStat.st_gid)==0 ){
28888
+ pDbFd->ctrlFlags |= UNIXFILE_CHOWN;
2887728889
}
2887828890
2887928891
/* Check to see if another process is holding the dead-man switch.
2888028892
** If not, truncate the file to zero length.
2888128893
*/
@@ -29865,14 +29877,18 @@
2986529877
** the default permissions.
2986629878
*/
2986729879
static int findCreateFileMode(
2986829880
const char *zPath, /* Path of file (possibly) being created */
2986929881
int flags, /* Flags passed as 4th argument to xOpen() */
29870
- mode_t *pMode /* OUT: Permissions to open file with */
29882
+ mode_t *pMode, /* OUT: Permissions to open file with */
29883
+ uid_t *pUid, /* OUT: uid to set on the file */
29884
+ gid_t *pGid /* OUT: gid to set on the file */
2987129885
){
2987229886
int rc = SQLITE_OK; /* Return Code */
2987329887
*pMode = SQLITE_DEFAULT_FILE_PERMISSIONS;
29888
+ *pUid = 0;
29889
+ *pGid = 0;
2987429890
if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
2987529891
char zDb[MAX_PATHNAME+1]; /* Database file path */
2987629892
int nDb; /* Number of valid bytes in zDb */
2987729893
struct stat sStat; /* Output of stat() on database file */
2987829894
@@ -29902,10 +29918,12 @@
2990229918
memcpy(zDb, zPath, nDb);
2990329919
zDb[nDb] = '\0';
2990429920
2990529921
if( 0==osStat(zDb, &sStat) ){
2990629922
*pMode = sStat.st_mode & 0777;
29923
+ *pUid = sStat.st_uid;
29924
+ *pGid = sStat.st_gid;
2990729925
}else{
2990829926
rc = SQLITE_IOERR_FSTAT;
2990929927
}
2991029928
}else if( flags & SQLITE_OPEN_DELETEONCLOSE ){
2991129929
*pMode = 0600;
@@ -30048,11 +30066,13 @@
3004830066
if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);
3004930067
openFlags |= (O_LARGEFILE|O_BINARY);
3005030068
3005130069
if( fd<0 ){
3005230070
mode_t openMode; /* Permissions to create file with */
30053
- rc = findCreateFileMode(zName, flags, &openMode);
30071
+ uid_t uid; /* Userid for the file */
30072
+ gid_t gid; /* Groupid for the file */
30073
+ rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);
3005430074
if( rc!=SQLITE_OK ){
3005530075
assert( !p->pUnused );
3005630076
assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );
3005730077
return rc;
3005830078
}
@@ -30069,10 +30089,21 @@
3006930089
}
3007030090
if( fd<0 ){
3007130091
rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
3007230092
goto open_finished;
3007330093
}
30094
+
30095
+ /* If this process is running as root and if creating a new rollback
30096
+ ** journal or WAL file, set the ownership of the journal or WAL to be
30097
+ ** the same as the original database. If we are not running as root,
30098
+ ** then the fchown() call will fail, but that's ok. The "if(){}" and
30099
+ ** the setting of the UNIXFILE_CHOWN flag are purely to silence compiler
30100
+ ** warnings from gcc.
30101
+ */
30102
+ if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
30103
+ if( fchown(fd, uid, gid)==0 ){ p->ctrlFlags |= UNIXFILE_CHOWN; }
30104
+ }
3007430105
}
3007530106
assert( fd>=0 );
3007630107
if( pOutFlags ){
3007730108
*pOutFlags = flags;
3007830109
}
@@ -30380,11 +30411,11 @@
3038030411
** tests repeatable.
3038130412
*/
3038230413
memset(zBuf, 0, nBuf);
3038330414
#if !defined(SQLITE_TEST)
3038430415
{
30385
- int pid, fd;
30416
+ int pid, fd, got;
3038630417
fd = robust_open("/dev/urandom", O_RDONLY, 0);
3038730418
if( fd<0 ){
3038830419
time_t t;
3038930420
time(&t);
3039030421
memcpy(zBuf, &t, sizeof(t));
@@ -30391,11 +30422,11 @@
3039130422
pid = getpid();
3039230423
memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
3039330424
assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf );
3039430425
nBuf = sizeof(t) + sizeof(pid);
3039530426
}else{
30396
- do{ nBuf = osRead(fd, zBuf, nBuf); }while( nBuf<0 && errno==EINTR );
30427
+ do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );
3039730428
robust_close(0, fd, __LINE__);
3039830429
}
3039930430
}
3040030431
#endif
3040130432
return nBuf;
@@ -58636,12 +58667,18 @@
5863658667
** the second condition under the assumption that addition overflow causes
5863758668
** values to wrap around. On x86 hardware, the third term is always
5863858669
** true and could be omitted. But we leave it in because other
5863958670
** architectures might behave differently.
5864058671
*/
58641
- if( pMem->r==(double)pMem->u.i && pMem->u.i>SMALLEST_INT64
58642
- && ALWAYS(pMem->u.i<LARGEST_INT64) ){
58672
+ if( pMem->r==(double)pMem->u.i
58673
+ && pMem->u.i>SMALLEST_INT64
58674
+#if defined(__i486__) || defined(__x86_64__)
58675
+ && ALWAYS(pMem->u.i<LARGEST_INT64)
58676
+#else
58677
+ && pMem->u.i<LARGEST_INT64
58678
+#endif
58679
+ ){
5864358680
pMem->flags |= MEM_Int;
5864458681
}
5864558682
}
5864658683
5864758684
/*
@@ -86423,11 +86460,11 @@
8642386460
** in a way that is testable, mask the sign bit off of negative
8642486461
** values, resulting in a positive value. Then take the
8642586462
** 2s complement of that positive value. The end result can
8642686463
** therefore be no less than -9223372036854775807.
8642786464
*/
86428
- r = -(r ^ (((sqlite3_int64)1)<<63));
86465
+ r = -(r & LARGEST_INT64);
8642986466
}
8643086467
sqlite3_result_int64(context, r);
8643186468
}
8643286469
8643386470
/*
8643486471
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -657,11 +657,11 @@
657 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
658 ** [sqlite_version()] and [sqlite_source_id()].
659 */
660 #define SQLITE_VERSION "3.7.11"
661 #define SQLITE_VERSION_NUMBER 3007011
662 #define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
663
664 /*
665 ** CAPI3REF: Run-Time Library Version Numbers
666 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
667 **
@@ -15216,13 +15216,15 @@
15216 */
15217 #define SQLITE_MALLOC(x) malloc(x)
15218 #define SQLITE_FREE(x) free(x)
15219 #define SQLITE_REALLOC(x,y) realloc((x),(y))
15220
 
 
 
15221 #ifdef HAVE_MALLOC_USABLE_SIZE
15222 # ifndef SQLITE_MALLOCSIZE
15223 # include <malloc.h>
15224 # define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
15225 # endif
15226 #else
15227 # undef SQLITE_MALLOCSIZE
15228 #endif
@@ -24970,11 +24972,11 @@
24970 sqlite3_io_methods const *pMethod; /* Always the first entry */
24971 sqlite3_vfs *pVfs; /* The VFS that created this unixFile */
24972 unixInodeInfo *pInode; /* Info about locks on this inode */
24973 int h; /* The file descriptor */
24974 unsigned char eFileLock; /* The type of lock held on this fd */
24975 unsigned char ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
24976 int lastErrno; /* The unix errno from last I/O error */
24977 void *lockingContext; /* Locking style specific state */
24978 UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */
24979 const char *zPath; /* Name of the file */
24980 unixShm *pShm; /* Shared memory segment information */
@@ -25021,10 +25023,11 @@
25021 #endif
25022 #define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
25023 #define UNIXFILE_DELETE 0x20 /* Delete on close */
25024 #define UNIXFILE_URI 0x40 /* Filename might have query parameters */
25025 #define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
 
25026
25027 /*
25028 ** Include code that is common to all os_*.c files
25029 */
25030 /************** Include os_common.h in the middle of os_unix.c ***************/
@@ -28868,14 +28871,23 @@
28868 openFlags = O_RDONLY;
28869 pShmNode->isReadonly = 1;
28870 }
28871 pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777));
28872 if( pShmNode->h<0 ){
28873 if( pShmNode->h<0 ){
28874 rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename);
28875 goto shm_open_err;
28876 }
 
 
 
 
 
 
 
 
 
28877 }
28878
28879 /* Check to see if another process is holding the dead-man switch.
28880 ** If not, truncate the file to zero length.
28881 */
@@ -29865,14 +29877,18 @@
29865 ** the default permissions.
29866 */
29867 static int findCreateFileMode(
29868 const char *zPath, /* Path of file (possibly) being created */
29869 int flags, /* Flags passed as 4th argument to xOpen() */
29870 mode_t *pMode /* OUT: Permissions to open file with */
 
 
29871 ){
29872 int rc = SQLITE_OK; /* Return Code */
29873 *pMode = SQLITE_DEFAULT_FILE_PERMISSIONS;
 
 
29874 if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
29875 char zDb[MAX_PATHNAME+1]; /* Database file path */
29876 int nDb; /* Number of valid bytes in zDb */
29877 struct stat sStat; /* Output of stat() on database file */
29878
@@ -29902,10 +29918,12 @@
29902 memcpy(zDb, zPath, nDb);
29903 zDb[nDb] = '\0';
29904
29905 if( 0==osStat(zDb, &sStat) ){
29906 *pMode = sStat.st_mode & 0777;
 
 
29907 }else{
29908 rc = SQLITE_IOERR_FSTAT;
29909 }
29910 }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){
29911 *pMode = 0600;
@@ -30048,11 +30066,13 @@
30048 if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);
30049 openFlags |= (O_LARGEFILE|O_BINARY);
30050
30051 if( fd<0 ){
30052 mode_t openMode; /* Permissions to create file with */
30053 rc = findCreateFileMode(zName, flags, &openMode);
 
 
30054 if( rc!=SQLITE_OK ){
30055 assert( !p->pUnused );
30056 assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );
30057 return rc;
30058 }
@@ -30069,10 +30089,21 @@
30069 }
30070 if( fd<0 ){
30071 rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
30072 goto open_finished;
30073 }
 
 
 
 
 
 
 
 
 
 
 
30074 }
30075 assert( fd>=0 );
30076 if( pOutFlags ){
30077 *pOutFlags = flags;
30078 }
@@ -30380,11 +30411,11 @@
30380 ** tests repeatable.
30381 */
30382 memset(zBuf, 0, nBuf);
30383 #if !defined(SQLITE_TEST)
30384 {
30385 int pid, fd;
30386 fd = robust_open("/dev/urandom", O_RDONLY, 0);
30387 if( fd<0 ){
30388 time_t t;
30389 time(&t);
30390 memcpy(zBuf, &t, sizeof(t));
@@ -30391,11 +30422,11 @@
30391 pid = getpid();
30392 memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
30393 assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf );
30394 nBuf = sizeof(t) + sizeof(pid);
30395 }else{
30396 do{ nBuf = osRead(fd, zBuf, nBuf); }while( nBuf<0 && errno==EINTR );
30397 robust_close(0, fd, __LINE__);
30398 }
30399 }
30400 #endif
30401 return nBuf;
@@ -58636,12 +58667,18 @@
58636 ** the second condition under the assumption that addition overflow causes
58637 ** values to wrap around. On x86 hardware, the third term is always
58638 ** true and could be omitted. But we leave it in because other
58639 ** architectures might behave differently.
58640 */
58641 if( pMem->r==(double)pMem->u.i && pMem->u.i>SMALLEST_INT64
58642 && ALWAYS(pMem->u.i<LARGEST_INT64) ){
 
 
 
 
 
 
58643 pMem->flags |= MEM_Int;
58644 }
58645 }
58646
58647 /*
@@ -86423,11 +86460,11 @@
86423 ** in a way that is testable, mask the sign bit off of negative
86424 ** values, resulting in a positive value. Then take the
86425 ** 2s complement of that positive value. The end result can
86426 ** therefore be no less than -9223372036854775807.
86427 */
86428 r = -(r ^ (((sqlite3_int64)1)<<63));
86429 }
86430 sqlite3_result_int64(context, r);
86431 }
86432
86433 /*
86434
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -657,11 +657,11 @@
657 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
658 ** [sqlite_version()] and [sqlite_source_id()].
659 */
660 #define SQLITE_VERSION "3.7.11"
661 #define SQLITE_VERSION_NUMBER 3007011
662 #define SQLITE_SOURCE_ID "2012-02-11 21:21:17 b022547389a40930cf0d2a75f5eb293acc9fbfe0"
663
664 /*
665 ** CAPI3REF: Run-Time Library Version Numbers
666 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
667 **
@@ -15216,13 +15216,15 @@
15216 */
15217 #define SQLITE_MALLOC(x) malloc(x)
15218 #define SQLITE_FREE(x) free(x)
15219 #define SQLITE_REALLOC(x,y) realloc((x),(y))
15220
15221 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE)
15222 # include <malloc.h> /* Needed for malloc_usable_size on linux */
15223 #endif
15224 #ifdef HAVE_MALLOC_USABLE_SIZE
15225 # ifndef SQLITE_MALLOCSIZE
 
15226 # define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
15227 # endif
15228 #else
15229 # undef SQLITE_MALLOCSIZE
15230 #endif
@@ -24970,11 +24972,11 @@
24972 sqlite3_io_methods const *pMethod; /* Always the first entry */
24973 sqlite3_vfs *pVfs; /* The VFS that created this unixFile */
24974 unixInodeInfo *pInode; /* Info about locks on this inode */
24975 int h; /* The file descriptor */
24976 unsigned char eFileLock; /* The type of lock held on this fd */
24977 unsigned short int ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
24978 int lastErrno; /* The unix errno from last I/O error */
24979 void *lockingContext; /* Locking style specific state */
24980 UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */
24981 const char *zPath; /* Name of the file */
24982 unixShm *pShm; /* Shared memory segment information */
@@ -25021,10 +25023,11 @@
25023 #endif
25024 #define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
25025 #define UNIXFILE_DELETE 0x20 /* Delete on close */
25026 #define UNIXFILE_URI 0x40 /* Filename might have query parameters */
25027 #define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
25028 #define UNIXFILE_CHOWN 0x100 /* File ownership was changed */
25029
25030 /*
25031 ** Include code that is common to all os_*.c files
25032 */
25033 /************** Include os_common.h in the middle of os_unix.c ***************/
@@ -28868,14 +28871,23 @@
28871 openFlags = O_RDONLY;
28872 pShmNode->isReadonly = 1;
28873 }
28874 pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777));
28875 if( pShmNode->h<0 ){
28876 rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename);
28877 goto shm_open_err;
28878 }
28879
28880 /* If this process is running as root, make sure that the SHM file
28881 ** is owned by the same user that owns the original database. Otherwise,
28882 ** the original owner will not be able to connect. If this process is
28883 ** not root, the following fchown() will fail, but we don't care. The
28884 ** if(){..} and the UNIXFILE_CHOWN flag are purely to silence compiler
28885 ** warnings.
28886 */
28887 if( fchown(pShmNode->h, sStat.st_uid, sStat.st_gid)==0 ){
28888 pDbFd->ctrlFlags |= UNIXFILE_CHOWN;
28889 }
28890
28891 /* Check to see if another process is holding the dead-man switch.
28892 ** If not, truncate the file to zero length.
28893 */
@@ -29865,14 +29877,18 @@
29877 ** the default permissions.
29878 */
29879 static int findCreateFileMode(
29880 const char *zPath, /* Path of file (possibly) being created */
29881 int flags, /* Flags passed as 4th argument to xOpen() */
29882 mode_t *pMode, /* OUT: Permissions to open file with */
29883 uid_t *pUid, /* OUT: uid to set on the file */
29884 gid_t *pGid /* OUT: gid to set on the file */
29885 ){
29886 int rc = SQLITE_OK; /* Return Code */
29887 *pMode = SQLITE_DEFAULT_FILE_PERMISSIONS;
29888 *pUid = 0;
29889 *pGid = 0;
29890 if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
29891 char zDb[MAX_PATHNAME+1]; /* Database file path */
29892 int nDb; /* Number of valid bytes in zDb */
29893 struct stat sStat; /* Output of stat() on database file */
29894
@@ -29902,10 +29918,12 @@
29918 memcpy(zDb, zPath, nDb);
29919 zDb[nDb] = '\0';
29920
29921 if( 0==osStat(zDb, &sStat) ){
29922 *pMode = sStat.st_mode & 0777;
29923 *pUid = sStat.st_uid;
29924 *pGid = sStat.st_gid;
29925 }else{
29926 rc = SQLITE_IOERR_FSTAT;
29927 }
29928 }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){
29929 *pMode = 0600;
@@ -30048,11 +30066,13 @@
30066 if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);
30067 openFlags |= (O_LARGEFILE|O_BINARY);
30068
30069 if( fd<0 ){
30070 mode_t openMode; /* Permissions to create file with */
30071 uid_t uid; /* Userid for the file */
30072 gid_t gid; /* Groupid for the file */
30073 rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);
30074 if( rc!=SQLITE_OK ){
30075 assert( !p->pUnused );
30076 assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );
30077 return rc;
30078 }
@@ -30069,10 +30089,21 @@
30089 }
30090 if( fd<0 ){
30091 rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
30092 goto open_finished;
30093 }
30094
30095 /* If this process is running as root and if creating a new rollback
30096 ** journal or WAL file, set the ownership of the journal or WAL to be
30097 ** the same as the original database. If we are not running as root,
30098 ** then the fchown() call will fail, but that's ok. The "if(){}" and
30099 ** the setting of the UNIXFILE_CHOWN flag are purely to silence compiler
30100 ** warnings from gcc.
30101 */
30102 if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
30103 if( fchown(fd, uid, gid)==0 ){ p->ctrlFlags |= UNIXFILE_CHOWN; }
30104 }
30105 }
30106 assert( fd>=0 );
30107 if( pOutFlags ){
30108 *pOutFlags = flags;
30109 }
@@ -30380,11 +30411,11 @@
30411 ** tests repeatable.
30412 */
30413 memset(zBuf, 0, nBuf);
30414 #if !defined(SQLITE_TEST)
30415 {
30416 int pid, fd, got;
30417 fd = robust_open("/dev/urandom", O_RDONLY, 0);
30418 if( fd<0 ){
30419 time_t t;
30420 time(&t);
30421 memcpy(zBuf, &t, sizeof(t));
@@ -30391,11 +30422,11 @@
30422 pid = getpid();
30423 memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
30424 assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf );
30425 nBuf = sizeof(t) + sizeof(pid);
30426 }else{
30427 do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );
30428 robust_close(0, fd, __LINE__);
30429 }
30430 }
30431 #endif
30432 return nBuf;
@@ -58636,12 +58667,18 @@
58667 ** the second condition under the assumption that addition overflow causes
58668 ** values to wrap around. On x86 hardware, the third term is always
58669 ** true and could be omitted. But we leave it in because other
58670 ** architectures might behave differently.
58671 */
58672 if( pMem->r==(double)pMem->u.i
58673 && pMem->u.i>SMALLEST_INT64
58674 #if defined(__i486__) || defined(__x86_64__)
58675 && ALWAYS(pMem->u.i<LARGEST_INT64)
58676 #else
58677 && pMem->u.i<LARGEST_INT64
58678 #endif
58679 ){
58680 pMem->flags |= MEM_Int;
58681 }
58682 }
58683
58684 /*
@@ -86423,11 +86460,11 @@
86460 ** in a way that is testable, mask the sign bit off of negative
86461 ** values, resulting in a positive value. Then take the
86462 ** 2s complement of that positive value. The end result can
86463 ** therefore be no less than -9223372036854775807.
86464 */
86465 r = -(r & LARGEST_INT64);
86466 }
86467 sqlite3_result_int64(context, r);
86468 }
86469
86470 /*
86471
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.11"
111111
#define SQLITE_VERSION_NUMBER 3007011
112
-#define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
112
+#define SQLITE_SOURCE_ID "2012-02-11 21:21:17 b022547389a40930cf0d2a75f5eb293acc9fbfe0"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.11"
111 #define SQLITE_VERSION_NUMBER 3007011
112 #define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.11"
111 #define SQLITE_VERSION_NUMBER 3007011
112 #define SQLITE_SOURCE_ID "2012-02-11 21:21:17 b022547389a40930cf0d2a75f5eb293acc9fbfe0"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button