Bugzilla – Bug 2036
wrong return code from dce_readv in case it fails within multiple buffers loop
Last modified: 2015-01-28 02:36:05 EST
In file model/dce-fd.cc, the dce_readv function always returns -1 in case any internal call to dce_read fails.
But when multiple buffers are present, dce_read may work for some of them and then fail. If returning -1, the caller will see it as a global error and considers nothing was read, while actually some buffers where read. The caller has no way to know something was read and will try again later, believing that the new call to readv provides data from the beginning.
Actually if at least one buffer was read in the first place, and a failure code is returned, the corresponding data is lost.
When a socket reads this way, the flow of data is no more correct (holes in reception).
The code of readv should aknowledge for size of data correctly read in some buffers, so that the caller sees this data.
The proposed correction in the source is the following:
diff -u dce-fd.cc.orig dce-fd.cc
--- dce-fd.cc.orig 2014-12-22 12:12:11.008435976 +0100
+++ dce-fd.cc 2014-12-22 12:14:09.310234589 +0100
@@ -410,7 +410,14 @@
- return -1;
+ if (0 == b)
+ return -1;
+ return ret;
thanks. applied your patch at changeset 0fd32ca088db.