diff options
| author | 2012-06-23 12:03:51 -0700 | |
|---|---|---|
| committer | 2012-06-23 12:03:51 -0700 | |
| commit | 612ca9c6a55bd932c45f5b85ae932a1b712dd914 (patch) | |
| tree | b84964d06ff0e97a7244def193fd009723a540a7 /libs | |
| parent | 5f77f82e609b24504e026751228b399b8dc57ab5 (diff) | |
| parent | 33d1ffacdd00bf58f4d24bab77281f3a745f8b68 (diff) | |
Merge "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 629b89926d5a..ce2b7ac0319b 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -752,7 +752,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; @@ -808,6 +810,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; } @@ -1099,7 +1104,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; } |