diff options
| author | Antony Dovgal <tony2001@php.net> | 2008-03-26 12:59:42 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2008-03-26 12:59:42 +0000 |
| commit | b103a34cda1f19f81f2295580ed136c1f979aa62 (patch) | |
| tree | e5df61b5c93e5612787a80334ce0187baef4b49d /main | |
| parent | c6aef571dd1745e90fc9fe0f12ba56be06f3080b (diff) | |
| download | php-git-b103a34cda1f19f81f2295580ed136c1f979aa62.tar.gz | |
MFH: check if return value of write() is -1 and abort upload, setting the correct error status
Diffstat (limited to 'main')
| -rw-r--r-- | main/rfc1867.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c index fcc1850de4..f04d3ac049 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1090,8 +1090,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) } 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 |
