Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix autoload +X nonexist leaving funcdef at dummy
% autoload +X nonexist
zsh:999: nonexist: function definition file not found
% nonexist
exec.c:6086: function definition nonexist has zero reference count
All the paths that set shf->funcdef in loadautofn call freeeprog on
the old one first anyway, so rather than make a new mkautofn if
loadautofn fails, just keep the old one.
---
Src/builtin.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Src/builtin.c b/Src/builtin.c
index 96bfd64cb5..d7ee2d0756 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3168,11 +3168,11 @@ eval_autoload(Shfunc shf, char *name, Options ops, int func)
if (!(shf->node.flags & PM_UNDEFINED))
return 1;
- if (shf->funcdef) {
- freeeprog(shf->funcdef);
- shf->funcdef = &dummy_eprog;
- }
if (OPT_MINUS(ops,'X')) {
+ if (shf->funcdef) {
+ freeeprog(shf->funcdef);
+ shf->funcdef = &dummy_eprog;
+ }
char *fargv[3];
fargv[0] = quotestring(name, QT_SINGLE_OPTIONAL);
fargv[1] = "\"$@\"";
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author