summaryrefslogtreecommitdiff
path: root/Src/module.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:32:59 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:58:59 +0200
commitdb38e167634b6c2217eec3a5aafc37c46d9e5a8d (patch)
treedaa342d423febbd3a5a7ef97053037677fab004a /Src/module.c
parent01eea47617a6e06debdb4330f92ae69f92089fd2 (diff)
parent3c3c8d3d13fd4cf6c03f81ca8dc18a1efd561728 (diff)
downloadzsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.tar.gz
zsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Src/module.c b/Src/module.c
index 9e8b3cc2a..368254c29 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;
@@ -1597,8 +1599,9 @@ do_load_module(char const *name, int silent)
ret = try_load_module(name);
if (!ret && !silent) {
#ifdef HAVE_DLERROR
+ char *errstr = dlerror();
zwarn("failed to load module `%s': %s", name,
- metafy(dlerror(), -1, META_USEHEAP));
+ errstr ? metafy(errstr, -1, META_HEAPDUP) : "empty module path");
#else
zwarn("failed to load module: %s", name);
#endif
@@ -3367,7 +3370,7 @@ mod_export int
handlefeatures(Module m, Features f, int **enables)
{
if (!enables || *enables)
- return setfeatureenables(m, f, *enables);
+ return setfeatureenables(m, f, enables ? *enables : NULL);
*enables = getfeatureenables(m, f);
return 0;
}