diff options
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r-- | generic/tclZlib.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 96d68c1..5dc8c2e 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclZlib.c,v 1.29 2009/07/09 22:48:44 patthoyts Exp $ + * RCS: @(#) $Id: tclZlib.c,v 1.30 2009/07/10 17:37:18 patthoyts Exp $ */ #include "tclInt.h" @@ -2322,11 +2322,16 @@ ZlibTransformClose( if (cd->outStream.avail_out != (unsigned) cd->outAllocated) { if (Tcl_WriteRaw(cd->parent, cd->outBuffer, cd->outAllocated - cd->outStream.avail_out) < 0) { - /* TODO: is this the right way to do errors on close? */ + /* TODO: is this the right way to do errors on close? + * Note: when close is called from FinalizeIOSubsystem + * then interp may be NULL + */ if (!TclInThreadExit()) { - Tcl_AppendResult(interp, + if (interp) { + Tcl_AppendResult(interp, "error while finalizing file: ", Tcl_PosixError(interp), NULL); + } } result = TCL_ERROR; break; @@ -2377,8 +2382,11 @@ ZlibTransformInput( return toRead - cd->inStream.avail_out; } if (e != Z_OK) { - Tcl_SetChannelError(cd->parent, - Tcl_NewStringObj(cd->inStream.msg, -1)); + Tcl_Obj *errObj = Tcl_NewListObj(0, NULL); + Tcl_ListObjAppendElement(NULL, errObj, + Tcl_NewStringObj(cd->inStream.msg, -1)); + Tcl_SetChannelError(cd->parent, errObj); + *errorCodePtr = EINVAL; return -1; } |