mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 19:20:12 +01:00
improved zip file handling
This commit is contained in:
parent
7a3aee5bc3
commit
9244105f4b
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.1.1"
|
#define VERSION "1.1.1"
|
||||||
|
|
||||||
#define BUILD 901
|
#define BUILD 902
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
|
@ -52,8 +52,11 @@ int extract_opendocument(struct session_data *sdata, struct _state *state, char
|
|||||||
struct zip_stat sb;
|
struct zip_stat sb;
|
||||||
struct zip_file *zf;
|
struct zip_file *zf;
|
||||||
|
|
||||||
z = zip_open(filename, 0, &errorp);
|
z = zip_open(filename, ZIP_CHECKCONS, &errorp);
|
||||||
if(!z) return 1;
|
if(!z){
|
||||||
|
syslog(LOG_INFO, "error: invalid zip file=%s, error code=%d", filename, errorp);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
@ -100,8 +103,11 @@ int unzip_file(struct session_data *sdata, struct _state *state, char *filename,
|
|||||||
|
|
||||||
(*rec)++;
|
(*rec)++;
|
||||||
|
|
||||||
z = zip_open(filename, 0, &errorp);
|
z = zip_open(filename, ZIP_CHECKCONS, &errorp);
|
||||||
if(!z) return 1;
|
if(!z){
|
||||||
|
syslog(LOG_INFO, "error: invalid zip file=%s, error code=%d", filename, errorp);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
while(zip_stat_index(z, i, 0, &sb) == 0){
|
while(zip_stat_index(z, i, 0, &sb) == 0){
|
||||||
//printf("processing file inside the zip: %s, index: %d, size: %d\n", sb.name, sb.index, (int)sb.size);
|
//printf("processing file inside the zip: %s, index: %d, size: %d\n", sb.name, sb.index, (int)sb.size);
|
||||||
|
Loading…
Reference in New Issue
Block a user