diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:44:00 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:44:00 -0800 |
commit | d24b8183b93e781080b2c16c487e60d51c12da31 (patch) | |
tree | fbb89154858984eb8e41556da7e9433040d55cd4 /libs/utils/Parcel.cpp | |
parent | f1e484acb594a726fb57ad0ae4cfe902c7f35858 (diff) |
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'libs/utils/Parcel.cpp')
-rw-r--r-- | libs/utils/Parcel.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/utils/Parcel.cpp b/libs/utils/Parcel.cpp index 0eba0b07c8d4..0f4b6473008d 100644 --- a/libs/utils/Parcel.cpp +++ b/libs/utils/Parcel.cpp @@ -658,15 +658,20 @@ status_t Parcel::writeNativeHandle(const native_handle& handle) status_t err; err = writeInt32(handle.numFds); if (err != NO_ERROR) return err; - + err = writeInt32(handle.numInts); if (err != NO_ERROR) return err; - + for (int i=0 ; err==NO_ERROR && i<handle.numFds ; i++) err = writeDupFileDescriptor(handle.data[i]); - + + if (err != NO_ERROR) { + LOGD("write native handle, write dup fd failed"); + return err; + } + err = write(handle.data + handle.numFds, sizeof(int)*handle.numInts); - + return err; } @@ -947,7 +952,7 @@ native_handle* Parcel::readNativeHandle(native_handle* (*alloc)(void*, int, int) } for (int i=0 ; err==NO_ERROR && i<numFds ; i++) { - h->data[i] = readFileDescriptor(); + h->data[i] = dup(readFileDescriptor()); if (h->data[i] < 0) err = BAD_VALUE; } |