]> granicus.if.org Git - php/commitdiff
MFH: check if return value of write() is -1 and abort upload in this case setting...
authorAntony Dovgal <tony2001@php.net>
Fri, 14 Mar 2008 13:11:12 +0000 (13:11 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 14 Mar 2008 13:11:12 +0000 (13:11 +0000)
main/rfc1867.c

index fcc1850de48f3c98f5725a1aafc5d46cde568469..1eda4f94c2abeba2bc6fdbb641954d4313e26cc5 100644 (file)
@@ -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