From: Antony Dovgal Date: Fri, 14 Mar 2008 13:11:12 +0000 (+0000) Subject: MFH: check if return value of write() is -1 and abort upload in this case setting... X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~592 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f6b35ccd37ac44e8f5c4fe0015a97ef656a277e;p=php MFH: check if return value of write() is -1 and abort upload in this case setting the correct error status --- diff --git a/main/rfc1867.c b/main/rfc1867.c index fcc1850de4..1eda4f94c2 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1091,7 +1091,13 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) 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