scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 65e5c373ca2fa947a604a1e0ea35843c8c104658
parent 93e07bb34a825734d760971f811ac43868fd8c48
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Tue, 28 Oct 2025 21:12:08 +0100

make: Use a local signal variable

As the global stop variable is used in cleanup() we can be
caught by one signal when we enter in cleanup but stop can
be pointing to a different signal at the end of that function.

Diffstat:
Msrc/cmd/scc-make/rules.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/cmd/scc-make/rules.c b/src/cmd/scc-make/rules.c @@ -62,10 +62,11 @@ lookup(char *name) static void cleanup(Target *tp) { - int precious; + int sig, precious; Target *p, **q; - printf("make: signal %d arrived\n", stop); + sig = stop; + printf("make: signal %d arrived\n", sig); precious = 0; p = lookup(".PRECIOUS"); @@ -81,8 +82,8 @@ cleanup(Target *tp) remove(tp->name); } - signal(stop, SIG_DFL); - raise(stop); + signal(sig, SIG_DFL); + raise(sig); } static int