Index: ./generic/tclIO.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v
retrieving revision 1.159
diff -w -u -r1.159 tclIO.c
--- ./generic/tclIO.c	10 Feb 2009 22:49:45 -0000	1.159
+++ ./generic/tclIO.c	23 Jul 2009 22:22:10 -0000
@@ -2085,6 +2085,14 @@
     int result;
 
     chanPtr = ((Channel *) chan)->state->bottomChanPtr;
+    if (!chanPtr->typePtr->getHandleProc) {
+	Tcl_Obj* err;
+	TclNewLiteralStringObj(err, "channel \"");
+	Tcl_AppendToObj(err, Tcl_GetChannelName(chan), -1);
+	Tcl_AppendToObj(err, "\" does not support OS handles", -1);
+	Tcl_SetChannelError (chan,err);
+	return TCL_ERROR;
+    }
     result = chanPtr->typePtr->getHandleProc(chanPtr->instanceData, direction,
 	    &handle);
     if (handlePtr) {
Index: ./generic/tclPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPipe.c,v
retrieving revision 1.21
diff -w -u -r1.21 tclPipe.c
--- ./generic/tclPipe.c	9 Jan 2009 11:21:46 -0000	1.21
+++ ./generic/tclPipe.c	23 Jul 2009 22:22:10 -0000
@@ -102,9 +102,15 @@
 	}
 	file = TclpMakeFile(chan, writing ? TCL_WRITABLE : TCL_READABLE);
 	if (file == NULL) {
+	    Tcl_Obj* msg;
+	    Tcl_GetChannelError(chan, &msg);
+	    if (msg) {
+		Tcl_SetObjResult (interp, msg);
+	    } else {
 	    Tcl_AppendResult(interp, "channel \"", Tcl_GetChannelName(chan),
 		    "\" wasn't opened for ",
 		    ((writing) ? "writing" : "reading"), NULL);
+	    }
 	    return NULL;
 	}
 	*releasePtr = 1;
