tony2001                Wed Mar 26 12:59:42 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main       rfc1867.c 
  Log:
  MFH: check if return value of write() is -1 and abort upload, setting the 
correct error status
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/rfc1867.c?r1=1.173.2.1.2.10&r2=1.173.2.1.2.11&diff_format=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.173.2.1.2.10 
php-src/main/rfc1867.c:1.173.2.1.2.11
--- php-src/main/rfc1867.c:1.173.2.1.2.10       Mon Dec 31 07:20:15 2007
+++ php-src/main/rfc1867.c      Wed Mar 26 12:59:42 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: rfc1867.c,v 1.173.2.1.2.10 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: rfc1867.c,v 1.173.2.1.2.11 2008/03/26 12:59:42 tony2001 Exp $ */
 
 /*
  *  This product includes software developed by the Apache Group
@@ -1090,8 +1090,14 @@
                                } else if (blen > 0) {
                                
                                        wlen = write(fd, buff, blen);
-                       
-                                       if (wlen < blen) {
+
+                                       if (wlen == -1) {
+                                               /* write failed */
+#if DEBUG_FILE_UPLOAD
+                                               
sapi_module.sapi_error(E_NOTICE, "write() failed - %s", strerror(errno));
+#endif
+                                               cancel_upload = UPLOAD_ERROR_F;
+                                       } else if (wlen < blen) {
 #if DEBUG_FILE_UPLOAD
                                                
sapi_module.sapi_error(E_NOTICE, "Only %d bytes were written, expected to write 
%d", wlen, blen);
 #endif



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

Reply via email to