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 (cherry picked from commit7d3f553f98
) Change-Id: Ie26bbecd3a74d61113b51c18832872499b97ee86 (cherry picked from commitb5e7eba6d1
)
This commit is contained in:
parent
2cf155713a
commit
1543fdf616
2 changed files with 14 additions and 2 deletions
|
@ -440,6 +440,12 @@ static inline __always_inline int _recursive_increment(pthread_mutex_t* mutex, i
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -516,6 +522,12 @@ int pthread_mutex_lock(pthread_mutex_t* mutex) {
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -206,10 +206,10 @@ int pthread_mutexattr_settype(pthread_mutexattr_t*, int) __nonnull((1));
|
|||
|
||||
int pthread_mutex_destroy(pthread_mutex_t*) __nonnull((1));
|
||||
int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __nonnull((1));
|
||||
int pthread_mutex_lock(pthread_mutex_t*) __nonnull((1));
|
||||
int pthread_mutex_lock(pthread_mutex_t*) /* __nonnull((1)) */;
|
||||
int pthread_mutex_timedlock(pthread_mutex_t*, const struct timespec*) __nonnull((1, 2));
|
||||
int pthread_mutex_trylock(pthread_mutex_t*) __nonnull((1));
|
||||
int pthread_mutex_unlock(pthread_mutex_t*) __nonnull((1));
|
||||
int pthread_mutex_unlock(pthread_mutex_t*) /* __nonnull((1)) */;
|
||||
|
||||
int pthread_once(pthread_once_t*, void (*)(void)) __nonnull((1, 2));
|
||||
|
||||
|
|
Loading…
Reference in a new issue