summaryrefslogtreecommitdiffstats
path: root/Src/module.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-25 19:20:08 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-27 00:18:47 +0100
commitcae0be3af69f32eee05028ca2ee0c4b6997171af (patch)
tree52c18fa740a500b4bdbdd78040dce80dedb6fbce /Src/module.c
parent34382: Handle NULL return from dlerror() more gracefully (diff)
downloadzsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.gz
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.bz2
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.lz
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.xz
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.zst
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.zip
34387: Avoid loading the main zsh binary as a module
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/module.c b/Src/module.c
index 97a4869cd..7dd47016c 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1577,7 +1577,9 @@ try_load_module(char const *name)
if (l + (**pp ? strlen(*pp) : 1) > PATH_MAX)
continue;
sprintf(buf, "%s/%s.%s", **pp ? *pp : ".", name, DL_EXT);
- ret = dlopen(unmeta(buf), RTLD_LAZY | RTLD_GLOBAL);
+ unmetafy(buf, NULL);
+ if (*buf) /* dlopen(NULL) returns a handle to the main binary */
+ ret = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
}
return ret;