summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-02-11 16:15:41 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-02-11 16:15:41 +0100
commitfac693de3881f996d50508d2e1891cc6f18276ac (patch)
treea0f92a42ee92801367d9dba3edc2ea334736d2a0
parent6b3c3b1916b0af0494041c12a3c86819e441105e (diff)
wgtpkg-zip: fix bug when file's size is zero
Change-Id: I0119f5855d5b09ff15e087289b13681ab7300110 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-zip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wgtpkg-zip.c b/src/wgtpkg-zip.c
index 8fe17c4..f7813c4 100644
--- a/src/wgtpkg-zip.c
+++ b/src/wgtpkg-zip.c
@@ -177,7 +177,9 @@ int zread(const char *zipfile, unsigned long long maxsize)
assert(fdesc != NULL);
err = zip_stat_index(zip, fdesc->zindex, ZIP_FL_ENC_GUESS, &zstat);
assert(zstat.name[0] != '/');
- if (zstat.size == 0) {
+ len = strlen(zstat.name);
+ assert(len > 0);
+ if (zstat.name[len - 1] == '/') {
/* directory name */
err = create_directory((char*)zstat.name, MODE_OF_DIRECTORY_CREATION);
if (err && errno != EEXIST)