thetaphi                Mon Apr  4 11:00:14 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src    NEWS 
    /php-src/main       rfc1867.c 
  Log:
  Bug #32491 (File upload error - unable to create a temporary file) - Changing 
file upload from stdio to posix
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.307&r2=1.1760.2.308&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.307 php-src/NEWS:1.1760.2.308
--- php-src/NEWS:1.1760.2.307   Mon Apr  4 06:52:19 2005
+++ php-src/NEWS        Mon Apr  4 11:00:13 2005
@@ -4,6 +4,8 @@
 - Fixed bug #32560 (configure looks for incorrect db2 library). (Tony)
 - Fixed bug #32530 (chunk_split() does not append endstr if chunklen is  
   longer then the original string). (Ilia)
+- Fixed bug #32491 (File upload error - unable to create a temporary file).
+  (Uwe Schindler)
 - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)).
   (kameshj at fastmail dot fm)
 
http://cvs.php.net/diff.php/php-src/main/rfc1867.c?r1=1.159.2.11&r2=1.159.2.12&ty=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.159.2.11 php-src/main/rfc1867.c:1.159.2.12
--- php-src/main/rfc1867.c:1.159.2.11   Mon Feb 14 19:26:35 2005
+++ php-src/main/rfc1867.c      Mon Apr  4 11:00:13 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: rfc1867.c,v 1.159.2.11 2005/02/15 00:26:35 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.159.2.12 2005/04/04 15:00:13 thetaphi Exp $ */
 
 /*
  *  This product includes software developed by the Apache Group
@@ -784,7 +784,7 @@
        zend_bool magic_quotes_gpc;
        multipart_buffer *mbuff;
        zval *array_ptr = (zval *) arg;
-       FILE *fp;
+       int fd=-1;
        zend_llist header;
 
        if (SG(request_info).content_length > SG(post_max_size)) {
@@ -969,8 +969,8 @@
 
                        if (!skip_upload) {
                                /* Handle file */
-                               fp = 
php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
-                               if (!fp) {
+                               fd = php_open_temporary_fd(PG(upload_tmp_dir), 
"php", &temp_filename TSRMLS_CC);
+                               if (fd==-1) {
                                        sapi_module.sapi_error(E_WARNING, "File 
upload error - unable to create a temporary file");
                                        cancel_upload = UPLOAD_ERROR_E;
                                }
@@ -1001,7 +1001,7 @@
 #endif
                                        cancel_upload = UPLOAD_ERROR_B;
                                } else if (blen > 0) {
-                                       wlen = fwrite(buff, 1, blen, fp);
+                                       wlen = write(fd, buff, blen);
                        
                                        if (wlen < blen) {
 #if DEBUG_FILE_UPLOAD
@@ -1013,8 +1013,8 @@
                                        }
                                } 
                        }
-                       if (fp) { /* may not be initialized if file could not 
be created */
-                               fclose(fp);
+                       if (fd!=-1) { /* may not be initialized if file could 
not be created */
+                               close(fd);
                        }
 
 #if DEBUG_FILE_UPLOAD

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

Reply via email to