diff options
author | dgp <dgp@users.sourceforge.net> | 2014-03-21 12:57:58 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-03-21 12:57:58 (GMT) |
commit | ff8fef8c8dda63391a0c88c52f35ff191cbed302 (patch) | |
tree | 1962604ec2987b7302e0891dcf7d9722a5cae479 /generic/tclIO.c | |
parent | 2a7cf86d3009255dc8f6a2a7d327c76b5ca231f7 (diff) | |
download | tcl-ff8fef8c8dda63391a0c88c52f35ff191cbed302.zip tcl-ff8fef8c8dda63391a0c88c52f35ff191cbed302.tar.gz tcl-ff8fef8c8dda63391a0c88c52f35ff191cbed302.tar.bz2 |
Fixup ChanRead() header. Note (dstSize > 0) precondition.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 10 |
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; } |