summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 15fc8af..9e675c6 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -3211,18 +3211,17 @@ Tcl_Close(
}
return TCL_ERROR;
}
- if (result != 0) {
- return TCL_ERROR;
- }
/*
- * Bug 97069ea11a: set error message if a flush code is set
+ * Bug 97069ea11a: set error message if a flush code is set and no error
+ * message set up to now.
*/
- if (flushcode != 0) {
+ if (flushcode != 0 && interp != NULL
+ && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp)) ) {
Tcl_SetErrno(flushcode);
- if (interp != NULL) {
- Tcl_SetObjResult(interp,
- Tcl_NewStringObj(Tcl_PosixError(interp), -1));
- }
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(Tcl_PosixError(interp), -1));
+ }
+ if ((flushcode != 0) || (result != 0)) {
return TCL_ERROR;
}
return TCL_OK;