From c9ec91b75fa4cb4f1042e930d14dc43bf680df85 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 18 Jul 2014 00:52:07 -0700 Subject: [PATCH] Forcibly disable some currently unsupported zip operations --- src/util/vfs-zip.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/util/vfs-zip.c b/src/util/vfs-zip.c index 7467c9f60..2446f8372 100644 --- a/src/util/vfs-zip.c +++ b/src/util/vfs-zip.c @@ -247,9 +247,20 @@ struct VDirEntry* _vdzListNext(struct VDir* vd) { struct VFile* _vdzOpenFile(struct VDir* vd, const char* path, int mode) { UNUSED(mode); - // TODO: support truncating, appending and creating - + // TODO: support truncating, appending and creating, and write struct VDirZip* vdz = (struct VDirZip*) vd; + + if ((mode & O_RDWR) == O_RDWR) { + // libzip doesn't allow for random access, so read/write is impossible without + // reading the entire file first. This approach will be supported eventually. + return 0; + } + + if (mode & O_WRONLY) { + // Write support is not yet implemented. + return 0; + } + struct zip_stat s; if (zip_stat(vdz->z, path, 0, &s) < 0) { return 0;