Blame SOURCES/environment-modules-3.2.10-unload-from-module.patch

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