Index: Makefile.in
==================================================================
--- Makefile.in
+++ Makefile.in
@@ -214,11 +214,11 @@
 	@echo "If you have documentation to create, place the commands to"
 	@echo "build the docs in the 'doc:' target.  For example:"
 	@echo "        xml2nroff sample.xml > sample.n"
 	@echo "        xml2html sample.xml > sample.html"
 
-install: all install-binaries install-libraries install-doc
+install: all install-binaries install-libraries
 
 install-binaries: binaries install-lib-binaries install-bin-binaries
 
 #========================================================================
 # This rule installs platform-independent files, such as header files.

Index: generic/tlsIO.c
==================================================================
--- generic/tlsIO.c
+++ generic/tlsIO.c
@@ -16,11 +16,10 @@
  *    SSLtcl (Peter Antman)
  *
  */
 
 #include "tlsInt.h"
-#include <errno.h>
 
 /*
  * Forward declarations
  */
 static void TlsChannelHandlerTimer(void *clientData);
@@ -53,11 +52,11 @@
 }
 
 /*
  *-------------------------------------------------------------------
  *
- * TlsCloseProc --
+ * TlsClose2Proc --
  *
  *    This procedure is invoked by the generic IO level to perform
  *    channel-type-specific cleanup when a SSL socket based channel
  *    is closed.
  *
@@ -69,10 +68,13 @@
  * Side effects:
  *    Closes the socket of the channel.
  *
  *-------------------------------------------------------------------
  */
+#if TCL_MAJOR_VERSION > 8
+#   define TlsCloseProc NULL /* No longer neccessary in Tcl 9 */
+#else
 static int TlsCloseProc(
     void *instanceData,
     TCL_UNUSED(Tcl_Interp *))
 {
     State *statePtr = (State *)instanceData;
@@ -81,22 +83,27 @@
 
     Tls_Clean(statePtr);
     Tcl_EventuallyFree(statePtr, Tls_Free);
     return TCL_OK;
 }
+#endif
 
 static int TlsClose2Proc(
     void *instanceData,    /* The socket state. */
     Tcl_Interp *interp,		/* For errors - can be NULL. */
     int flags)			/* Flags to close read and/or write side of channel */
 {
-    dprintf("TlsClose2Proc(%p)", instanceData);
+    State *statePtr = (State *)instanceData;
 
-    if (!(flags & (TCL_CLOSE_READ|TCL_CLOSE_WRITE))) {
-	return TlsCloseProc(instanceData, interp);
+    dprintf("TlsClose2Proc(%p)", statePtr);
+
+    if ((flags&(TCL_CLOSE_READ|TCL_CLOSE_WRITE))) {
+	return EINVAL;
     }
-    return EINVAL;
+    Tls_Clean(statePtr);
+    Tcl_EventuallyFree(statePtr, Tls_Free);
+    return TCL_OK;
 }
 
 /*
  *------------------------------------------------------*
  *
@@ -760,11 +767,10 @@
      */
     dprintf("Registering our interest in the lower channel (chan=%p)", (void *) downChan);
     watchProc = Tcl_ChannelWatchProc(Tcl_GetChannelType(downChan));
     watchProc(Tcl_GetChannelInstanceData(downChan), mask);
 
-
     /*
      * Management of the internal timer.
      */
     if (statePtr->timer != (Tcl_TimerToken) NULL) {
 	dprintf("A timer was found, deleting it");
@@ -891,11 +897,11 @@
  *        None.
  *
  *------------------------------------------------------*
  */
 static void TlsChannelHandlerTimer(void *clientData) {
-    State *statePtr = (State *) clientData;
+    State *statePtr = (State *)clientData;
     int mask = 0;
 
     dprintf("Called");
 
     statePtr->timer = (Tcl_TimerToken) NULL;
@@ -925,11 +931,11 @@
 
     if ((statePtr->flags & ~maskFlags) & TLS_TCL_FASTPATH) {
 	dprintf("Asked to get the parent channel while we are using FastPath -- returning NULL");
 	return(NULL);
     }
-    return(Tcl_GetStackedChannel(statePtr->self));
+    return Tcl_GetStackedChannel(statePtr->self);
 }
 
 /*
  *-------------------------------------------------------------------
  *