diff options
author | Johannes Carlsson <johannes.carlsson.x@sonyericsson.com> | 2012-06-25 14:06:56 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-25 14:06:56 -0700 |
commit | 3443b333f16cd356d7cc7322810fe6188f58f1d9 (patch) | |
tree | b3aabc8556e80d3c99019c5eb78b29a272b50cd8 /libs | |
parent | b7c839b1103f72f8eb89fc0e19f7805969fc622f (diff) | |
parent | db1597a98958b78dc0d8eced19ae1406382b70d6 (diff) | |
download | frameworks_native-3443b333f16cd356d7cc7322810fe6188f58f1d9.zip frameworks_native-3443b333f16cd356d7cc7322810fe6188f58f1d9.tar.gz frameworks_native-3443b333f16cd356d7cc7322810fe6188f58f1d9.tar.bz2 |
am db1597a9: Fix shutdown sequence to avoid SIGSEGV when running am command
* commit 'db1597a98958b78dc0d8eced19ae1406382b70d6':
Fix shutdown sequence to avoid SIGSEGV when running am command
Diffstat (limited to 'libs')
-rw-r--r-- | libs/binder/IPCThreadState.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index 7a3a3b9..7e416b9 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -758,7 +758,9 @@ finish: status_t IPCThreadState::talkWithDriver(bool doReceive) { - ALOG_ASSERT(mProcess->mDriverFD >= 0, "Binder driver is not opened"); + if (mProcess->mDriverFD <= 0) { + return -EBADF; + } binder_write_read bwr; @@ -814,6 +816,9 @@ status_t IPCThreadState::talkWithDriver(bool doReceive) #else err = INVALID_OPERATION; #endif + if (mProcess->mDriverFD <= 0) { + err = -EBADF; + } IF_LOG_COMMANDS() { alog << "Finished read/write, write size = " << mOut.dataSize() << endl; } @@ -1106,7 +1111,9 @@ void IPCThreadState::threadDestructor(void *st) if (self) { self->flushCommands(); #if defined(HAVE_ANDROID_OS) - ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); + if (self->mProcess->mDriverFD > 0) { + ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); + } #endif delete self; } |