Ilia, let me know if you want me to commit this to 5_2.

The patch is supposed to prevent appearing _FILES with negative size and 
missing error when write() fails.

On 03/14/2008 04:11 PM, Antony Dovgal wrote:
> tony2001              Fri Mar 14 13:11:12 2008 UTC
> 
>   Modified files:              (Branch: PHP_5_3)
>     /php-src/main     rfc1867.c 
>   Log:
>   MFH: check if return value of write() is -1 and abort upload in this case 
> setting the correct error status
>   
>   
> http://cvs.php.net/viewvc.cgi/php-src/main/rfc1867.c?r1=1.173.2.1.2.9.2.1&r2=1.173.2.1.2.9.2.2&diff_format=u
> Index: php-src/main/rfc1867.c
> diff -u php-src/main/rfc1867.c:1.173.2.1.2.9.2.1 
> php-src/main/rfc1867.c:1.173.2.1.2.9.2.2
> --- php-src/main/rfc1867.c:1.173.2.1.2.9.2.1  Mon Dec 31 07:17:17 2007
> +++ php-src/main/rfc1867.c    Fri Mar 14 13:11:12 2008
> @@ -17,7 +17,7 @@
>     +----------------------------------------------------------------------+
>   */
>  
> -/* $Id: rfc1867.c,v 1.173.2.1.2.9.2.1 2007/12/31 07:17:17 sebastian Exp $ */
> +/* $Id: rfc1867.c,v 1.173.2.1.2.9.2.2 2008/03/14 13:11:12 tony2001 Exp $ */
>  
>  /*
>   *  This product includes software developed by the Apache Group
> @@ -1091,7 +1091,13 @@
>                               
>                                       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
> 
> 
> 


-- 
Wbr, 
Antony Dovgal

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

Reply via email to