summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-10-04 07:54:06 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-04 07:54:06 -0700
commit6d95c0d941fa0d9ea50b74e60baf82956a4d4452 (patch)
tree89b9d1f34e4ccbba4ef98dfea8f3f8911dcc8b3d /libs/utils
parent51d2adab83837425dae8062b7ff2a5bd1e732dd9 (diff)
parentac7540733cafcca5bdb1842e1ebcb396ba064583 (diff)
downloadframeworks_base-6d95c0d941fa0d9ea50b74e60baf82956a4d4452.zip
frameworks_base-6d95c0d941fa0d9ea50b74e60baf82956a4d4452.tar.gz
frameworks_base-6d95c0d941fa0d9ea50b74e60baf82956a4d4452.tar.bz2
am ac754073: am b58b2714: Merge "ZipFileRO: moar logging and wrap close" into gingerbread
Merge commit 'ac7540733cafcca5bdb1842e1ebcb396ba064583' * commit 'ac7540733cafcca5bdb1842e1ebcb396ba064583': ZipFileRO: moar logging and wrap close
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/ZipFileRO.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp
index 9fcae72..bee86b2 100644
--- a/libs/utils/ZipFileRO.cpp
+++ b/libs/utils/ZipFileRO.cpp
@@ -86,6 +86,16 @@ using namespace android;
*/
#define kZipEntryAdj 10000
+ZipFileRO::~ZipFileRO() {
+ free(mHashTable);
+ if (mDirectoryMap)
+ mDirectoryMap->release();
+ if (mFd >= 0)
+ TEMP_FAILURE_RETRY(close(mFd));
+ if (mFileName)
+ free(mFileName);
+}
+
/*
* Convert a ZipEntryRO to a hash table index, verifying that it's in a
* valid range.
@@ -122,7 +132,7 @@ status_t ZipFileRO::open(const char* zipFileName)
mFileLength = lseek(fd, 0, SEEK_END);
if (mFileLength < kEOCDLen) {
- close(fd);
+ TEMP_FAILURE_RETRY(close(fd));
return UNKNOWN_ERROR;
}
@@ -152,7 +162,7 @@ status_t ZipFileRO::open(const char* zipFileName)
bail:
free(mFileName);
mFileName = NULL;
- close(fd);
+ TEMP_FAILURE_RETRY(close(fd));
return UNKNOWN_ERROR;
}
@@ -512,12 +522,14 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen,
LOGW("failed reading lfh from offset %ld\n", localHdrOffset);
return false;
}
- }
- if (get4LE(lfhBuf) != kLFHSignature) {
- LOGW("didn't find signature at start of lfh, offset=%ld (got 0x%08lx, expected 0x%08x)\n",
- localHdrOffset, get4LE(lfhBuf), kLFHSignature);
- return false;
+ if (get4LE(lfhBuf) != kLFHSignature) {
+ off_t actualOffset = lseek(mFd, 0, SEEK_CUR);
+ LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
+ "got: offset=%zd data=0x%08lx\n",
+ localHdrOffset, kLFHSignature, (size_t)actualOffset, get4LE(lfhBuf));
+ return false;
+ }
}
off_t dataOffset = localHdrOffset + kLFHLen