Orion Poplawski 6b4be82
diff -up modules-3.2.10/ModuleCmd_Load.c.unload_from_modulefile modules-3.2.10/ModuleCmd_Load.c
Orion Poplawski 6b4be82
--- modules-3.2.10/ModuleCmd_Load.c.unload_from_modulefile	2014-07-08 10:43:41.615212949 +0200
Orion Poplawski 6b4be82
+++ modules-3.2.10/ModuleCmd_Load.c	2014-07-08 13:49:21.674701003 +0200
Orion Poplawski 6b4be82
@@ -126,7 +126,7 @@ int	ModuleCmd_Load(	Tcl_Interp	*interp,
Orion Poplawski 6b4be82
      **  Set up the flags controling the Tcl callback functions
Orion Poplawski 6b4be82
      **/
Orion Poplawski 6b4be82
 
Orion Poplawski 6b4be82
-	/* avoid changes when invoked as a subcommand */
Orion Poplawski 6b4be82
+	/* avoid changes when invoked as a subcommand and loading */
Orion Poplawski 6b4be82
 	if (!(g_flags & M_SUBCMD)) {
Orion Poplawski 6b4be82
 	    if( load) {
Orion Poplawski 6b4be82
 		g_flags |= M_LOAD;
Orion Poplawski 6b4be82
@@ -136,6 +136,11 @@ int	ModuleCmd_Load(	Tcl_Interp	*interp,
Orion Poplawski 6b4be82
 		g_flags &= ~M_LOAD;
Orion Poplawski 6b4be82
 	    }
Orion Poplawski 6b4be82
 	    g_flags |= M_SUBCMD;
Orion Poplawski 6b4be82
+	} else {
Orion Poplawski 6b4be82
+	    if (!load) {
Orion Poplawski 6b4be82
+		g_flags |= M_REMOVE;
Orion Poplawski 6b4be82
+		g_flags &= ~M_LOAD;
Orion Poplawski 6b4be82
+	    }
Orion Poplawski 6b4be82
 	}
Orion Poplawski 6b4be82
     
Orion Poplawski 6b4be82
     /**