summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2008-03-26 12:59:42 +0000
committerAntony Dovgal <tony2001@php.net>2008-03-26 12:59:42 +0000
commitb103a34cda1f19f81f2295580ed136c1f979aa62 (patch)
treee5df61b5c93e5612787a80334ce0187baef4b49d /main
parentc6aef571dd1745e90fc9fe0f12ba56be06f3080b (diff)
downloadphp-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.c10
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