From 7eb7567aa3faebfb22bd052f3505d485ee23d585 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Tue, 16 Oct 2012 10:47:27 -0700 Subject: Remove HAVE_SELINUX guards Change-Id: Ia96201f20f7838d7d9e8926208977d3f8318ced4 --- minzip/Android.mk | 8 ++------ minzip/DirUtil.c | 5 ----- minzip/DirUtil.h | 4 ---- minzip/Zip.c | 4 ---- minzip/Zip.h | 4 ---- 5 files changed, 2 insertions(+), 23 deletions(-) (limited to 'minzip') diff --git a/minzip/Android.mk b/minzip/Android.mk index 6c1d0969c..045f35570 100644 --- a/minzip/Android.mk +++ b/minzip/Android.mk @@ -8,15 +8,11 @@ LOCAL_SRC_FILES := \ Inlines.c \ Zip.c -LOCAL_C_INCLUDES += \ +LOCAL_C_INCLUDES := \ external/zlib \ external/safe-iop/include -ifeq ($(HAVE_SELINUX),true) -LOCAL_C_INCLUDES += external/libselinux/include -LOCAL_STATIC_LIBRARIES += libselinux -LOCAL_CFLAGS += -DHAVE_SELINUX -endif +LOCAL_STATIC_LIBRARIES := libselinux LOCAL_MODULE := libminzip diff --git a/minzip/DirUtil.c b/minzip/DirUtil.c index 0d49b5780..8dd5da1da 100644 --- a/minzip/DirUtil.c +++ b/minzip/DirUtil.c @@ -145,24 +145,19 @@ dirCreateHierarchy(const char *path, int mode, } else if (ds == DMISSING) { int err; -#ifdef HAVE_SELINUX char *secontext = NULL; if (sehnd) { selabel_lookup(sehnd, &secontext, cpath, mode); setfscreatecon(secontext); } -#endif err = mkdir(cpath, mode); -#ifdef HAVE_SELINUX - if (secontext) { freecon(secontext); setfscreatecon(NULL); } -#endif if (err != 0) { free(cpath); diff --git a/minzip/DirUtil.h b/minzip/DirUtil.h index f8be64026..a5cfa761b 100644 --- a/minzip/DirUtil.h +++ b/minzip/DirUtil.h @@ -24,12 +24,8 @@ extern "C" { #endif -#ifdef HAVE_SELINUX #include #include -#else -struct selabel_handle; -#endif /* Like "mkdir -p", try to guarantee that all directories * specified in path are present, creating as many directories diff --git a/minzip/Zip.c b/minzip/Zip.c index 54d5d55a3..c87f038c5 100644 --- a/minzip/Zip.c +++ b/minzip/Zip.c @@ -1115,23 +1115,19 @@ bool mzExtractRecursive(const ZipArchive *pArchive, * Open the target for writing. */ -#ifdef HAVE_SELINUX char *secontext = NULL; if (sehnd) { selabel_lookup(sehnd, &secontext, targetFile, UNZIP_FILEMODE); setfscreatecon(secontext); } -#endif int fd = creat(targetFile, UNZIP_FILEMODE); -#ifdef HAVE_SELINUX if (secontext) { freecon(secontext); setfscreatecon(NULL); } -#endif if (fd < 0) { LOGE("Can't create target file \"%s\": %s\n", diff --git a/minzip/Zip.h b/minzip/Zip.h index 4bb9ef6a4..c94282827 100644 --- a/minzip/Zip.h +++ b/minzip/Zip.h @@ -18,12 +18,8 @@ extern "C" { #endif -#ifdef HAVE_SELINUX #include #include -#else -struct selabel_handle; -#endif /* * One entry in the Zip archive. Treat this as opaque -- use accessors below. -- cgit v1.2.3 From bf80f49edcec6b22ad7b1219e6ed6eda1e930c8c Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 19 Oct 2012 12:24:26 -0700 Subject: reduce some recovery logging Make minzip log only a count of files when extracting, not individual filenames. Make patching only chatter about free space if there's not enough and compact the other messages. Only the last 8k of the recovery log gets uploaded; this makes it more likely that we will get all of it. Change-Id: I529cb4947fe2185df82b9da5fae450a7480dcecd --- minzip/Zip.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'minzip') diff --git a/minzip/Zip.c b/minzip/Zip.c index c87f038c5..439e5d9cd 100644 --- a/minzip/Zip.c +++ b/minzip/Zip.c @@ -985,6 +985,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive, unsigned int i; bool seenMatch = false; int ok = true; + int extractCount = 0; for (i = 0; i < pArchive->numEntries; i++) { ZipEntry *pEntry = pArchive->pEntries + i; if (pEntry->fileNameLen < zipDirLen) { @@ -1150,13 +1151,16 @@ bool mzExtractRecursive(const ZipArchive *pArchive, break; } - LOGD("Extracted file \"%s\"\n", targetFile); + LOGV("Extracted file \"%s\"\n", targetFile); + ++extractCount; } } if (callback != NULL) callback(targetFile, cookie); } + LOGD("Extracted %d file(s)\n", extractCount); + free(helper.buf); free(zpath); -- cgit v1.2.3 From c86f22c131ef72bd3350720d2029766c4f0721f3 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 17 Dec 2012 09:26:50 -0800 Subject: Pass the correct pointer to munmap on failure. This won't ever happen, and you're probably screwed anyway if it does, but that's no excuse... Change-Id: I2c56f607e351e84308a72b41b834d13aaa98fc62 --- minzip/SysUtil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'minzip') diff --git a/minzip/SysUtil.c b/minzip/SysUtil.c index 49a2522d6..31c76d6d4 100644 --- a/minzip/SysUtil.c +++ b/minzip/SysUtil.c @@ -95,16 +95,16 @@ int sysLoadFileInShmem(int fd, MemMapping* pMap) if (memPtr == NULL) return -1; - actual = read(fd, memPtr, length); + pMap->baseAddr = pMap->addr = memPtr; + pMap->baseLength = pMap->length = length; + + actual = TEMP_FAILURE_RETRY(read(fd, memPtr, length)); if (actual != length) { LOGE("only read %d of %d bytes\n", (int) actual, (int) length); sysReleaseShmem(pMap); return -1; } - pMap->baseAddr = pMap->addr = memPtr; - pMap->baseLength = pMap->length = length; - return 0; } -- cgit v1.2.3