diff options
author | Michael Lentine <mlentine@google.com> | 2014-10-02 19:44:43 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-02 19:44:43 +0000 |
commit | dea558703a737d7e017a4f7991ea7b0367916654 (patch) | |
tree | c828f6e15a085c9efcb3cd2e1de93e4defea71e4 /libs | |
parent | 5653d5de0d021ba5f5ba8671085a8e0a9fcb37d2 (diff) | |
parent | 36462d9de00105ae46ee3dbb0f644fa6af599f97 (diff) | |
download | frameworks_native-dea558703a737d7e017a4f7991ea7b0367916654.zip frameworks_native-dea558703a737d7e017a4f7991ea7b0367916654.tar.gz frameworks_native-dea558703a737d7e017a4f7991ea7b0367916654.tar.bz2 |
am 36462d9d: Merge "Add more logging for dup(fd) failure" into lmp-dev
* commit '36462d9de00105ae46ee3dbb0f644fa6af599f97':
Add more logging for dup(fd) failure
Diffstat (limited to 'libs')
-rw-r--r-- | libs/binder/Parcel.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 76504ce..ba5688c 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -36,6 +36,7 @@ #include <private/binder/binder_module.h> +#include <fcntl.h> #include <inttypes.h> #include <stdio.h> #include <stdlib.h> @@ -1280,11 +1281,22 @@ status_t Parcel::read(FlattenableHelperInterface& val) const status_t err = NO_ERROR; for (size_t i=0 ; i<fd_count && err==NO_ERROR ; i++) { - fds[i] = dup(this->readFileDescriptor()); + int oldfd = this->readFileDescriptor(); + fds[i] = dup(oldfd); if (fds[i] < 0) { + int dupErrno = errno; err = BAD_VALUE; - ALOGE("dup() failed in Parcel::read, i is %zu, fds[i] is %d, fd_count is %zu, error: %s", - i, fds[i], fd_count, strerror(errno)); + int flags = fcntl(oldfd, F_GETFD); + int fcntlErrno = errno; + const flat_binder_object* flat = readObject(true); + ALOGE("dup failed in Parcel::read, fd %zu of %zu\n" + " dup(%d) = %d [errno: %d (%s)]\n" + " fcntl(%d, F_GETFD) = %d [errno: %d (%s)]\n" + " flat %p type %d", + i, fd_count, + oldfd, fds[i], dupErrno, strerror(dupErrno), + oldfd, flags, fcntlErrno, strerror(fcntlErrno), + flat, flat ? flat->type : 0); } } |