cvs: php-src(PHP_5_2) /main rfc1867.c
| From: | Antony Dovgal | Date: | Wed, 26 Mar 2008 12:59:42 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /main rfc1867.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-49385@lists.php.net to get a copy of this message | ||
tony2001 Wed Mar 26 12:59:42 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main rfc1867.c
Log:
MFH: check if return value of write() is -1 and abort upload, setting the correct error status
http://cvs.php.net/viewvc.cgi/php-src/main/rfc1867.c?r1=1.173.2.1.2.10&r2=1.173.2.1.2.11&diff_format=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.173.2.1.2.10 php-src/main/rfc1867.c:1.173.2.1.2.11
--- php-src/main/rfc1867.c:1.173.2.1.2.10 Mon Dec 31 07:20:15 2007
+++ php-src/main/rfc1867.c Wed Mar 26 12:59:42 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.173.2.1.2.10 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: rfc1867.c,v 1.173.2.1.2.11 2008/03/26 12:59:42 tony2001 Exp $ */
/*
* This product includes software developed by the Apache Group
@@ -1090,8 +1090,14 @@
} 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