Implement zip_fdopen and ZIP_AFL_RDONLY. This allows to open a zip archive from an already open file descriptor; archives opened this way are marked read-only. --HG-- branch : HEAD
diff --git a/lib/zip_set_archive_comment.c b/lib/zip_set_archive_comment.c index 343fa54..3bb85d1 100644 --- a/lib/zip_set_archive_comment.c +++ b/lib/zip_set_archive_comment.c
@@ -1,6 +1,6 @@ /* zip_set_archive_comment.c -- set archive comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <libzip@nih.at> @@ -50,6 +50,11 @@ return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if (len > 0) { if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) return -1;