summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2014-03-21 12:57:58 (GMT)
committerdgp@users.sourceforge.net <dgp>2014-03-21 12:57:58 (GMT)
commit4dacdcac4ba75246b02f9847dea5ec490d35bfca (patch)
tree1962604ec2987b7302e0891dcf7d9722a5cae479
parent6cf3f0f32b978d0328d5152077453850b3e69ac4 (diff)
downloadtcl-4dacdcac4ba75246b02f9847dea5ec490d35bfca.zip
tcl-4dacdcac4ba75246b02f9847dea5ec490d35bfca.tar.gz
tcl-4dacdcac4ba75246b02f9847dea5ec490d35bfca.tar.bz2
Fixup ChanRead() header. Note (dstSize > 0) precondition.
-rw-r--r--generic/tclIO.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 6e5dc05..e7eaefa 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -346,8 +346,8 @@ static Tcl_ObjType chanObjType = {
*
* ChanRead --
*
- * Read up to bytes using the inputProc of chanPtr, store them at dst,
- * and return the number of bytes stored.
+ * Read up to dstsize bytes using the inputProc of chanPtr, store
+ * them at dst, and return the number of bytes stored.
*
* Results:
* The return value of the driver inputProc,
@@ -373,6 +373,12 @@ ChanRead(
{
int bytesRead, result;
+ /*
+ * If the caller asked for zero bytes, we'd force the inputProc
+ * to return zero bytes, and then misinterpret that as EOF
+ */
+ assert(dstSize > 0);
+
if (WillRead(chanPtr) < 0) {
return -1;
}