pajoye          Fri Jan  2 00:21:53 2009 UTC

  Modified files:              
    /php-src/ext/zip/lib        zip_close.c 
  Log:
  - MFB: restore fix for binary mode on win (regression introduced in 5.2.8)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/lib/zip_close.c?r1=1.10&r2=1.11&diff_format=u
Index: php-src/ext/zip/lib/zip_close.c
diff -u php-src/ext/zip/lib/zip_close.c:1.10 
php-src/ext/zip/lib/zip_close.c:1.11
--- php-src/ext/zip/lib/zip_close.c:1.10        Wed Dec 31 11:12:38 2008
+++ php-src/ext/zip/lib/zip_close.c     Fri Jan  2 00:21:53 2009
@@ -636,13 +636,14 @@
     char *temp;
     int tfd;
     FILE *tfp;
+       int len = strlen(za->zn) + 8;
 
-    if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) {
+    if ((temp=(char *)malloc(len)) == NULL) {
        _zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
        return NULL;
     }
 
-    sprintf(temp, "%s.XXXXXX", za->zn);
+               snprintf(temp, len, "%s.XXXXXX", za->zn);
 
     if ((tfd=mkstemp(temp)) == -1) {
        _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
@@ -657,6 +658,9 @@
        free(temp);
        return NULL;
     }
+#ifdef PHP_WIN32
+       _setmode(_fileno(tfp), _O_BINARY );
+#endif
 
     *outp = tfp;
     return temp;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to