1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
diff -ru libzip-0.10.orig/lib/zip_fclose.c libzip-0.10/lib/zip_fclose.c
--- libzip-0.10.orig/lib/zip_fclose.c 2010-03-08 13:27:48.000000000 +0100
+++ libzip-0.10/lib/zip_fclose.c 2011-07-03 11:07:22.000000000 +0200
@@ -47,7 +47,7 @@
if (zf->src)
zip_source_free(zf->src);
- for (i=0; i<zf->za->nfile; i++) {
+ if (zf->za) for (i=0; i<zf->za->nfile; i++) {
if (zf->za->file[i] == zf) {
zf->za->file[i] = zf->za->file[zf->za->nfile-1];
zf->za->nfile--;
Seulement dans libzip-0.10/lib: zip_fclose.c~
diff -ru libzip-0.10.orig/lib/zip.h libzip-0.10/lib/zip.h
--- libzip-0.10.orig/lib/zip.h 2011-03-04 18:17:43.000000000 +0100
+++ libzip-0.10/lib/zip.h 2011-07-03 11:38:39.000000000 +0200
@@ -59,6 +59,7 @@
#define ZIP_CREATE 1
#define ZIP_EXCL 2
#define ZIP_CHECKCONS 4
+#define ZIP_OVERWRITE 8
/* flags for zip_name_locate, zip_fopen, zip_stat, ... */
Seulement dans libzip-0.10/lib: zip.h~
diff -ru libzip-0.10.orig/lib/zip_name_locate.c libzip-0.10/lib/zip_name_locate.c
--- libzip-0.10.orig/lib/zip_name_locate.c 2011-02-13 16:06:21.000000000 +0100
+++ libzip-0.10/lib/zip_name_locate.c 2011-07-03 14:24:44.000000000 +0200
@@ -91,6 +91,7 @@
return i;
}
- _zip_error_set(error, ZIP_ER_NOENT, 0);
+/* Look for an entry should not raise an error */
+/* _zip_error_set(error, ZIP_ER_NOENT, 0);*/
return -1;
}
Seulement dans libzip-0.10/lib: zip_name_locate.c~
diff -ru libzip-0.10.orig/lib/zip_open.c libzip-0.10/lib/zip_open.c
--- libzip-0.10.orig/lib/zip_open.c 2011-03-16 12:18:44.000000000 +0100
+++ libzip-0.10/lib/zip_open.c 2011-07-03 11:19:41.000000000 +0200
@@ -62,9 +62,15 @@
{
FILE *fp;
+ if (flags & ZIP_OVERWRITE) {
+ return _zip_allocate_new(fn, zep);
+ }
+
switch (_zip_file_exists(fn, flags, zep)) {
case -1:
- return NULL;
+ if (!(flags & ZIP_OVERWRITE)) {
+ return NULL;
+ }
case 0:
return _zip_allocate_new(fn, zep);
default:
@@ -482,7 +488,7 @@
}
if (stat(fn, &st) != 0) {
- if (flags & ZIP_CREATE)
+ if (flags & ZIP_CREATE || flags & ZIP_OVERWRITE)
return 0;
else {
set_error(zep, NULL, ZIP_ER_OPEN);
Seulement dans libzip-0.10/lib: zip_open.c~
|