Tcl Source Code

Artifact [b8dbfeeaa9]
Login

Artifact b8dbfeeaa9b4885f1dfc87dac68fbc383fcbbe8f:

Attachment "getsobj.patch" to ticket [491341ffff] added by dgp 2001-12-13 05:03:39.
Index: generic/tclIO.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v
retrieving revision 1.41
diff -u -r1.41 tclIO.c
--- generic/tclIO.c	2001/11/07 04:47:54	1.41
+++ generic/tclIO.c	2001/12/12 22:01:29
@@ -3631,13 +3631,13 @@
 	if (statePtr->flags & CHANNEL_EOF) {
 	    skip = 0;
 	    eol = dstEnd;
-	    if (eol == objPtr->bytes) {
+	    if (eol == objPtr->bytes + oldLength) {
 		/*
-		 * If we didn't produce any bytes before encountering EOF,
+		 * If we didn't append any bytes before encountering EOF,
 		 * caller needs to see -1.
 		 */
 
-		Tcl_SetObjLength(objPtr, 0);
+		Tcl_SetObjLength(objPtr, oldLength);
 		CommonGetsCleanup(chanPtr, encoding);
 		copiedTotal = -1;
 		goto done;