summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2001-08-06 22:17:58 (GMT)
committerandreas_kupries <akupries@shaw.ca>2001-08-06 22:17:58 (GMT)
commit02b7fc064fe51c7ec01f8977ae28ccfb38e84e62 (patch)
treedf632a7947e608c330914293a69b46bf4b916474
parent08e4fd1498331778fdd40ef19c8d25fb07ca7278 (diff)
downloadtcl-02b7fc064fe51c7ec01f8977ae28ccfb38e84e62.zip
tcl-02b7fc064fe51c7ec01f8977ae28ccfb38e84e62.tar.gz
tcl-02b7fc064fe51c7ec01f8977ae28ccfb38e84e62.tar.bz2
2001-08-06 Andreas Kupries <andreas_kupries@users.sourceforge.net>
* generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from SF item [442665] to fix the bug reported by it.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclIOCmd.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 03d9af2..47be923 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-06 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from SF item
+ [442665] to fix the bug reported by it.
+
2001-08-06 Don Porter <dgp@users.sourceforge.net>
* doc/tclsh.1: Added note that the tclsh program is frequently
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 78ab3cf..5fb3a15 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOCmd.c,v 1.8 2001/07/31 19:12:06 vincentdarley Exp $
+ * RCS: @(#) $Id: tclIOCmd.c,v 1.9 2001/08/06 22:17:58 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -228,8 +228,6 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
- resultPtr = Tcl_GetObjResult(interp);
- linePtr = resultPtr;
if (objc == 3) {
/*
* Variable gets line, interp get bytecount.
@@ -237,11 +235,14 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv)
linePtr = Tcl_NewObj();
}
+ else {
+ linePtr = Tcl_GetObjResult(interp);
+ }
lineLen = Tcl_GetsObj(chan, linePtr);
if (lineLen < 0) {
if (!Tcl_Eof(chan) && !Tcl_InputBlocked(chan)) {
- if (linePtr != resultPtr) {
+ if (objc == 3) {
Tcl_DecrRefCount(linePtr);
}
Tcl_ResetResult(interp);
@@ -257,6 +258,7 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv)
Tcl_DecrRefCount(linePtr);
return TCL_ERROR;
}
+ resultPtr = Tcl_GetObjResult(interp);
Tcl_SetIntObj(resultPtr, lineLen);
return TCL_OK;
}