diff options
author | Pierre Joye <pajoye@php.net> | 2006-11-03 16:46:19 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2006-11-03 16:46:19 +0000 |
commit | 8ad0c6d543f5161c5a42536002884a30c153fefd (patch) | |
tree | 961388a6f097141242ea3c8744a4c1d1c77be72b /ext/zip/lib/zip_source_filep.c | |
parent | c002606a8888a0b85b7095c8809b136a815e0bab (diff) | |
download | php-git-8ad0c6d543f5161c5a42536002884a30c153fefd.tar.gz |
- MFH:
- fix possible leak in statName and statIndex
- add addEmptyDir() method
- add zip_stat_init,zip_clear_error and zip_file_clear_error
- add tests
- Fix protos (Hannes)
- setComment return value on success (Hannes)
Diffstat (limited to 'ext/zip/lib/zip_source_filep.c')
-rw-r--r-- | ext/zip/lib/zip_source_filep.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index 9c7383cf29..da08ba42bb 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -2,7 +2,7 @@ $NiH: zip_source_filep.c,v 1.6 2005/06/09 19:57:10 dillo Exp $ zip_source_filep.c -- create data source from FILE * - Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2006 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -138,24 +138,20 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) if (len < sizeof(*st)) return -1; - st = (struct zip_stat *)data; - if (fstat(fileno(z->f), &fst) != 0) { z->e[0] = ZIP_ER_READ; /* best match */ z->e[1] = errno; return -1; } + st = (struct zip_stat *)data; + + zip_stat_init(st); st->mtime = fst.st_mtime; - st->crc = 0; if (z->len != -1) st->size = z->len; else if ((fst.st_mode&S_IFMT) == S_IFREG) st->size = fst.st_size; - else - st->size = -1; - st->comp_size = -1; - st->comp_method = ZIP_CM_STORE; return sizeof(*st); } |