Skip to content
Permalink
Browse files

Adapt ijar for WSL

fix build fail because of ijar under Windows Subsystem for Linux
(based on commit b51a8cb05ae989815157d82ed86cfa3a6fbf53fc from
https://github.com/bazelbuild/bazel)

Change-Id: Ibf45c7f6afa5099e4440a8e33aac01b374ad3480
  • Loading branch information
KevMck authored and luca020400 committed Jul 28, 2018
1 parent 55f630b commit 14925d0308495cc0877f52cbdbce3d2f320eaea1
Showing with 5 additions and 3 deletions.
  1. +5 −3 tools/ijar/zip.cc
@@ -197,8 +197,9 @@ class InputZipFile : public ZipExtractor {
//
class OutputZipFile : public ZipBuilder {
public:
OutputZipFile(int fd, u1 * const zipdata_out) :
OutputZipFile(int fd, u1 * const zipdata_out, size_t mmap_length) :
fd_out(fd),
mmap_length_(mmap_length),
zipdata_out_(zipdata_out),
q(zipdata_out) {
errmsg[0] = 0;
@@ -252,7 +253,7 @@ class OutputZipFile : public ZipBuilder {
};

int fd_out; // file descriptor for the output file

size_t mmap_length_;
// OutputZipFile is responsible for maintaining the following
// pointers. They are allocated by the Create() method before
// the object is actually created using mmap.
@@ -933,6 +934,7 @@ size_t OutputZipFile::WriteFileSizeInLocalFileHeader(u1 *header_ptr,
int OutputZipFile::Finish() {
if (fd_out > 0) {
WriteCentralDirectory();
munmap(zipdata_out_, mmap_length_);
if (ftruncate(fd_out, GetSize()) < 0) {
return error("ftruncate(fd_out, GetSize()): %s", strerror(errno));
}
@@ -1001,7 +1003,7 @@ ZipBuilder* ZipBuilder::Create(const char* zip_file, u8 estimated_size) {
return NULL;
}

return new OutputZipFile(fd_out, (u1*) zipdata_out);
return new OutputZipFile(fd_out, (u1*) zipdata_out, mmap_length);
}

u8 ZipBuilder::EstimateSize(char **files) {

0 comments on commit 14925d0

Please sign in to comment.
You can’t perform that action at this time.