tony2001 Fri Mar 14 13:10:23 2008 UTC
Modified files:
/php-src/main rfc1867.c
Log:
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.192&r2=1.193&diff_format=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.192 php-src/main/rfc1867.c:1.193
--- php-src/main/rfc1867.c:1.192 Mon Dec 31 07:12:18 2007
+++ php-src/main/rfc1867.c Fri Mar 14 13:10:22 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.192 2007/12/31 07:12:18 sebastian Exp $ */
+/* $Id: rfc1867.c,v 1.193 2008/03/14 13:10:22 tony2001 Exp $ */
/*
* This product includes software developed by the Apache Group
@@ -1263,7 +1263,13 @@
} else if (blen > 0) {
wlen = fwrite(buff, 1, blen, fp);
- 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
@@ -1712,7 +1718,13 @@
} 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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php