summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-03-21 12:57:58 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-03-21 12:57:58 (GMT)
commit657b902a0e5afa5596833584329b653f7c0f277d (patch)
tree1962604ec2987b7302e0891dcf7d9722a5cae479 /generic/tclIO.c
parente21cda73652e2cf4a060a0411e779935b427a154 (diff)
downloadtcl-657b902a0e5afa5596833584329b653f7c0f277d.zip
tcl-657b902a0e5afa5596833584329b653f7c0f277d.tar.gz
tcl-657b902a0e5afa5596833584329b653f7c0f277d.tar.bz2
Fixup ChanRead() header. Note (dstSize > 0) precondition.
Diffstat (limited to 'generic/tclIO.c')
-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;
}