aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2015-07-01 17:20:02 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-07-02 09:23:13 +0000
commit5bf02b34cb96a97cb6a8fa383d5c6eab3c34f8da (patch)
treeb0f8b6abb2636048760cfd73f562f7bbbb115d82 /third_party
parent1b9123646e21b05ed1ff8706f4b0f32c7d2efd60 (diff)
Fix zipper for empty files
It was erroring out because it could not mmap an empty file. -- MOS_MIGRATED_REVID=97338974
Diffstat (limited to 'third_party')
-rwxr-xr-xthird_party/ijar/test/zip_test.sh1
-rw-r--r--third_party/ijar/zip_main.cc2
2 files changed, 2 insertions, 1 deletions
diff --git a/third_party/ijar/test/zip_test.sh b/third_party/ijar/test/zip_test.sh
index b3247fd60b..83ca3f5e0a 100755
--- a/third_party/ijar/test/zip_test.sh
+++ b/third_party/ijar/test/zip_test.sh
@@ -52,6 +52,7 @@ function assert_zipper_same_after_unzip() {
function test_zipper() {
mkdir -p ${TEST_TMPDIR}/test/path/to/some
mkdir -p ${TEST_TMPDIR}/test/some/other/path
+ touch ${TEST_TMPDIR}/test/path/to/some/empty_file
echo "toto" > ${TEST_TMPDIR}/test/path/to/some/file
echo "titi" > ${TEST_TMPDIR}/test/path/to/some/other_file
chmod +x ${TEST_TMPDIR}/test/path/to/some/other_file
diff --git a/third_party/ijar/zip_main.cc b/third_party/ijar/zip_main.cc
index cd5c2f39be..aeda2370e2 100644
--- a/third_party/ijar/zip_main.cc
+++ b/third_party/ijar/zip_main.cc
@@ -218,7 +218,7 @@ int create(char *zipfile, char **files, bool flatten, bool verbose) {
}
u1 *buffer = builder->NewFile(path, mode_to_zipattr(statst.st_mode));
- if (isdir) {
+ if (isdir || statst.st_size == 0) {
builder->FinishFile(0);
} else {
// mmap the input file and memcpy