thetaphi                Mon Apr  4 10:59:58 2005 EDT

  Modified files:              (Branch: PHP_4_3)
    /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.1247.2.868&r2=1.1247.2.869&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.868 php-src/NEWS:1.1247.2.869
--- php-src/NEWS:1.1247.2.868   Sun Apr  3 14:09:55 2005
+++ php-src/NEWS        Mon Apr  4 10:59:56 2005
@@ -7,6 +7,8 @@
   (adam dot greenfield at gmail dot com)
 - 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)
 
 31 Mar 2005, Version 4.3.11
 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
http://cvs.php.net/diff.php/php-src/main/rfc1867.c?r1=1.122.2.33&r2=1.122.2.34&ty=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.122.2.33 php-src/main/rfc1867.c:1.122.2.34
--- php-src/main/rfc1867.c:1.122.2.33   Mon Feb 14 19:28:39 2005
+++ php-src/main/rfc1867.c      Mon Apr  4 10:59:58 2005
@@ -16,7 +16,7 @@
    |          Jani Taskinen <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: rfc1867.c,v 1.122.2.33 2005/02/15 00:28:39 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.122.2.34 2005/04/04 14:59:58 thetaphi Exp $ */
 
 /*
  *  This product includes software developed by the Apache Group
@@ -779,7 +779,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)) {
@@ -962,8 +962,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;
                                }
@@ -990,7 +990,7 @@
                                        sapi_module.sapi_error(E_WARNING, 
"MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not saved", max_file_size, 
param, filename);
                                        cancel_upload = UPLOAD_ERROR_B;
                                } else if (blen > 0) {
-                                       wlen = fwrite(buff, 1, blen, fp);
+                                       wlen = write(fd, buff, blen);
                        
                                        if (wlen < blen) {
                                                
sapi_module.sapi_error(E_WARNING, "Only %d bytes were written, expected to 
write %d", wlen, blen);
@@ -1000,8 +1000,8 @@
                                        }
                                } 
                        } 
-                       if (fp) {
-                               fclose(fp);
+                       if (fd!=-1) {
+                               close(fd);
                        }
 
 #ifdef DEBUG_FILE_UPLOAD

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

Reply via email to