cvs: pecl /phar phar_object.c
| From: | Steph Fox | Date: | Sat, 03 May 2008 21:09:55 +0000 |
| Subject: | cvs: pecl /phar phar_object.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-10694@lists.php.net to get a copy of this message | ||
sfox Sat May 3 21:09:55 2008 UTC
Modified files:
/pecl/phar phar_object.c
Log:
- Kill Windows warning when int meets short
- All tests still pass
http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.255&r2=1.256&diff_format=u
Index: pecl/phar/phar_object.c
diff -u pecl/phar/phar_object.c:1.255 pecl/phar/phar_object.c:1.256
--- pecl/phar/phar_object.c:1.255 Sat May 3 02:04:23 2008
+++ pecl/phar/phar_object.c Sat May 3 21:09:55 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: phar_object.c,v 1.255 2008/05/03 02:04:23 cellog Exp $ */
+/* $Id: phar_object.c,v 1.256 2008/05/03 21:09:55 sfox Exp $ */
#include "phar_internal.h"
#include "func_interceptors.h"
@@ -3517,6 +3517,7 @@
int len;
php_stream *fp;
char *fullpath, *slash;
+ mode_t mode;
len = spprintf(&fullpath, 0, "%s/%s", dest, entry->filename);
if (len >= MAXPATHLEN) {
@@ -3586,11 +3587,13 @@
}
fp = php_stream_open_wrapper(fullpath, "w+b", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
+
if (!fp) {
spprintf(error, 4096, "Cannot extract \"%s\", could not open for writing
\"%s\"", entry->filename, fullpath);
efree(fullpath);
return FAILURE;
}
+
if (!phar_get_efp(entry, 0 TSRMLS_CC)) {
if (FAILURE == phar_open_entry_fp(entry, error, 1 TSRMLS_CC)) {
if (error) {
@@ -3603,24 +3606,30 @@
return FAILURE;
}
}
+
if (FAILURE == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", unable to seek
internal file pointer", entry->filename, fullpath);
efree(fullpath);
php_stream_close(fp);
return FAILURE;
}
+
if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry, 0 TSRMLS_CC),
fp, entry->uncompressed_filesize)) {
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", copying contents
failed", entry->filename, fullpath);
efree(fullpath);
php_stream_close(fp);
return FAILURE;
}
+
php_stream_close(fp);
- if (-1 == VCWD_CHMOD(fullpath, entry->flags & PHAR_ENT_PERM_MASK)) {
+ mode = (mode_t) entry->flags & PHAR_ENT_PERM_MASK;
+
+ if (FAILURE == VCWD_CHMOD(fullpath, mode)) {
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", setting file
permissions failed", entry->filename, fullpath);
efree(fullpath);
return FAILURE;
}
+
efree(fullpath);
return SUCCESS;
}