summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/src/mutex_unix.c
diff options
context:
space:
mode:
authorjturner <jturner@openbsd.org>2015-04-19 14:21:33 +0000
committerjturner <jturner@openbsd.org>2015-04-19 14:21:33 +0000
commit195e5996de6de62491ca3cfe673e94ad6087aad7 (patch)
tree4ee42085a9591772cf064f0d1a9b78ecd61e7c61 /lib/libsqlite3/src/mutex_unix.c
parentDecouple the token code for "no request or macro" from the individual (diff)
downloadwireguard-openbsd-195e5996de6de62491ca3cfe673e94ad6087aad7.tar.xz
wireguard-openbsd-195e5996de6de62491ca3cfe673e94ad6087aad7.zip
Update sqlite3 to 3.8.9. Changes available here:
http://sqlite.org/releaselog/3_8_9.html Tested in bulk and ok landry@
Diffstat (limited to 'lib/libsqlite3/src/mutex_unix.c')
-rw-r--r--lib/libsqlite3/src/mutex_unix.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/libsqlite3/src/mutex_unix.c b/lib/libsqlite3/src/mutex_unix.c
index c936914d8aa..e08448e0229 100644
--- a/lib/libsqlite3/src/mutex_unix.c
+++ b/lib/libsqlite3/src/mutex_unix.c
@@ -40,8 +40,10 @@
*/
struct sqlite3_mutex {
pthread_mutex_t mutex; /* Mutex controlling the lock */
-#if SQLITE_MUTEX_NREF
+#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)
int id; /* Mutex type */
+#endif
+#if SQLITE_MUTEX_NREF
volatile int nRef; /* Number of entrances */
volatile pthread_t owner; /* Thread that is within this mutex */
int trace; /* True to trace changes */
@@ -158,18 +160,12 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){
pthread_mutex_init(&p->mutex, &recursiveAttr);
pthread_mutexattr_destroy(&recursiveAttr);
#endif
-#if SQLITE_MUTEX_NREF
- p->id = iType;
-#endif
}
break;
}
case SQLITE_MUTEX_FAST: {
p = sqlite3MallocZero( sizeof(*p) );
if( p ){
-#if SQLITE_MUTEX_NREF
- p->id = iType;
-#endif
pthread_mutex_init(&p->mutex, 0);
}
break;
@@ -182,12 +178,12 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){
}
#endif
p = &staticMutexes[iType-2];
-#if SQLITE_MUTEX_NREF
- p->id = iType;
-#endif
break;
}
}
+#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)
+ if( p ) p->id = iType;
+#endif
return p;
}
@@ -199,9 +195,18 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){
*/
static void pthreadMutexFree(sqlite3_mutex *p){
assert( p->nRef==0 );
- assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
- pthread_mutex_destroy(&p->mutex);
- sqlite3_free(p);
+#if SQLITE_ENABLE_API_ARMOR
+ if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE )
+#endif
+ {
+ pthread_mutex_destroy(&p->mutex);
+ sqlite3_free(p);
+ }
+#ifdef SQLITE_ENABLE_API_ARMOR
+ else{
+ (void)SQLITE_MISUSE_BKPT;
+ }
+#endif
}
/*