Work around a bug in Immersion's libImmEmulatorJ.so.
This library calls pthread_mutex_lock and pthread_mutex_unlock with a NULL
pthread_mutex_t*. This gives them (and their users) one release to fix things.
Bug: 17443936
Change-Id: I3b63c9a3dd63db0833f21073e323b3236a13b47a
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index cbb6ef7..b338e51 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -448,6 +448,12 @@
}
int pthread_mutex_lock(pthread_mutex_t* mutex) {
+#if !defined(__LP64__)
+ if (mutex == NULL) {
+ return EINVAL;
+ }
+#endif
+
int mvalue, mtype, tid, shared;
mvalue = mutex->value;
@@ -526,6 +532,12 @@
}
int pthread_mutex_unlock(pthread_mutex_t* mutex) {
+#if !defined(__LP64__)
+ if (mutex == NULL) {
+ return EINVAL;
+ }
+#endif
+
int mvalue, mtype, tid, shared;
mvalue = mutex->value;