Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zsh bugfixes released by RedHat
On Nov 6, 6:04pm, Christian Neukirchen wrote:
}
} Patch23: BZ-978613-malloc-from-signal-handler-workaround.patch
Thanks. This patch actually doesn't make a lot of sense, because
free() is #define macro'd to zfree() which already contains calls
to do signal queueing around all the interesting parts.
If there really has been a signal problem discovered here, I think
the following is a more complete fix, as calling a signal handler
with cmdstack and cmpsp out of sync would be just as bad as calling
it within a malloc operation.
diff --git a/Src/exec.c b/Src/exec.c
index d2d4e80..042215d 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4555,6 +4555,7 @@ execshfunc(Shfunc shf, LinkList args)
fputc('\n', xtrerr);
fflush(xtrerr);
}
+ queue_signals();
ocs = cmdstack;
ocsp = cmdsp;
cmdstack = (unsigned char *) zalloc(CMDSTACKSZ);
@@ -4562,7 +4563,11 @@ execshfunc(Shfunc shf, LinkList args)
if ((osfc = sfcontext) == SFC_NONE)
sfcontext = SFC_DIRECT;
xtrerr = stderr;
+ unqueue_signals();
+
doshfunc(shf, args, 0);
+
+ queue_signals();
sfcontext = osfc;
free(cmdstack);
cmdstack = ocs;
@@ -4570,6 +4575,7 @@ execshfunc(Shfunc shf, LinkList args)
if (!list_pipe)
deletefilelist(last_file_list, 0);
+ unqueue_signals();
}
/*
Messages sorted by:
Reverse Date,
Date,
Thread,
Author