diff options
author | Kenny Root <kroot@google.com> | 2012-10-12 23:39:47 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-12 23:39:48 -0700 |
commit | 9bdaa60b809b223d14619d1f13afdd38acb1738d (patch) | |
tree | 8f5da1658896e4ee0060f3a945f4f59d4ec77e4e | |
parent | dd57d551944c01394bc2807d962be4953c58c7c1 (diff) | |
parent | 3de9cd202948d1b8f372f901c812ef4257af5946 (diff) | |
download | frameworks_native-9bdaa60b809b223d14619d1f13afdd38acb1738d.zip frameworks_native-9bdaa60b809b223d14619d1f13afdd38acb1738d.tar.gz frameworks_native-9bdaa60b809b223d14619d1f13afdd38acb1738d.tar.bz2 |
Merge "Add TEMP_FAILURE_RETRY around open and write calls" into jb-mr1-dev
-rw-r--r-- | libs/utils/ZipFileRO.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp index cc62213..ef49c0f 100644 --- a/libs/utils/ZipFileRO.cpp +++ b/libs/utils/ZipFileRO.cpp @@ -140,7 +140,7 @@ status_t ZipFileRO::open(const char* zipFileName) /* * Open and map the specified file. */ - fd = ::open(zipFileName, O_RDONLY | O_BINARY); + fd = TEMP_FAILURE_RETRY(::open(zipFileName, O_RDONLY | O_BINARY)); if (fd < 0) { ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); return NAME_NOT_FOUND; @@ -771,7 +771,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const ptr = (const unsigned char*) file->getDataPtr(); if (method == kCompressStored) { - ssize_t actual = write(fd, ptr, uncompLen); + ssize_t actual = TEMP_FAILURE_RETRY(write(fd, ptr, uncompLen)); if (actual < 0) { ALOGE("Write failed: %s\n", strerror(errno)); goto unmap; @@ -920,9 +920,12 @@ bail: (zerr == Z_STREAM_END && zstream.avail_out != sizeof(writeBuf))) { long writeSize = zstream.next_out - writeBuf; - int cc = write(fd, writeBuf, writeSize); - if (cc != (int) writeSize) { - ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); + int cc = TEMP_FAILURE_RETRY(write(fd, writeBuf, writeSize)); + if (cc < 0) { + ALOGW("write failed in inflate: %s", strerror(errno)); + goto z_bail; + } else if (cc != (int) writeSize) { + ALOGW("write failed in inflate (%d vs %ld)", cc, writeSize); goto z_bail; } |