summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-04-04 11:14:17 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-04-04 11:14:17 (GMT)
commit752977e0aefc7b66132f50015152a8847bfcb50d (patch)
tree2e44b7292fa7bcfdd954d84ed41fde2909022f7f /generic/tclIO.c
parentf4cedcbce197fa8bedcd0bdbff05b9434adef7b4 (diff)
parent83674895910aaf2ff10fd52075b53e39020d8568 (diff)
downloadtcl-752977e0aefc7b66132f50015152a8847bfcb50d.zip
tcl-752977e0aefc7b66132f50015152a8847bfcb50d.tar.gz
tcl-752977e0aefc7b66132f50015152a8847bfcb50d.tar.bz2
Fix for Bug [97069ea11a]: Set return message in close if a flush error is reported (which may be an error from a background flush)
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 6793320..e14cc25 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -3270,7 +3270,17 @@ Tcl_Close(
Tcl_SetObjResult(interp,
Tcl_NewStringObj(Tcl_PosixError(interp), -1));
}
- flushcode = -1;
+ return TCL_ERROR;
+ }
+ /*
+ * Bug 97069ea11a: set error message if a flush code is set and no error
+ * message set up to now.
+ */
+ if (flushcode != 0 && interp != NULL
+ && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp)) ) {
+ Tcl_SetErrno(flushcode);
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(Tcl_PosixError(interp), -1));
}
if ((flushcode != 0) || (result != 0)) {
return TCL_ERROR;