summary refs log tree commit diff
path: root/Src/module.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-08-09 10:02:08 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-08-09 10:02:08 +0000
commitc73dd460190ca602114503d8dea3171165ff099e (patch)
tree1e398be5a08cf032dbddbd18b88e045c92752d91 /Src/module.c
parentaa638fec26a316b00ebbb2f5f620faf600b8f6ae (diff)
downloadzsh-c73dd460190ca602114503d8dea3171165ff099e.tar.gz
zsh-c73dd460190ca602114503d8dea3171165ff099e.tar.xz
zsh-c73dd460190ca602114503d8dea3171165ff099e.zip
Fixes from Thorsten Dahlheimer.
21578: mkmakemod.sh didn't exit on cleanup.
21582: fix failure status of zmodload -R.
21583: fix circularity test of zmodload -A.
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/Src/module.c b/Src/module.c
index 7a0fcf811..ee493ad0c 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1043,7 +1043,6 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
      */
     LinkNode node;
     Module m;
-    int ret = 0;
 
     if (!*args) {
 	if (OPT_ISSET(ops,'R')) {
@@ -1058,7 +1057,7 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
 	return 0;
     }
 
-    for (; !ret && *args; args++) {
+    for (; *args; args++) {
 	char *eqpos = strchr(*args, '=');
 	char *aliasname = eqpos ? eqpos+1 : NULL;
 	if (eqpos)
@@ -1078,8 +1077,7 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
 		m = (Module) getdata(node);
 		if (!(m->flags & MOD_ALIAS)) {
 		    zwarnnam(nam, "module is not an alias: %s", *args, 0);
-		    ret = 1;
-		    break;
+		    return 1;
 		}
 		delete_module(node);
 	    } else {
@@ -1093,12 +1091,15 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
 		    zwarnnam(nam, "invalid module name `%s'", aliasname, 0);
 		    return 1;
 		}
-		find_module(aliasname, 1, &mname);
-		if (!strcmp(mname, *args)) {
-		    zwarnnam(nam, "module alias would refer to itself: %s",
-			     *args, 0);
-		    return 1;
-		}
+		do {
+		    if (!strcmp(mname, *args)) {
+			zwarnnam(nam, "module alias would refer to itself: %s",
+				 *args, 0);
+			return 1;
+		    }
+		} while ((node = find_module(mname, 0, NULL))
+			 && ((m = (Module) getdata(node))->flags & MOD_ALIAS)
+			 && (mname = m->u.alias));
 		node = find_module(*args, 0, NULL);
 		if (node) {
 		    m = (Module) getdata(node);