make: Use a local signal variable - scc - simple c99 compiler
 (HTM) git clone git://git.simple-cc.org/scc
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 65e5c373ca2fa947a604a1e0ea35843c8c104658
 (DIR) parent 93e07bb34a825734d760971f811ac43868fd8c48
 (HTM) 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:
         M src/cmd/scc-make/rules.c            |       9 +++++----
       
       1 file changed, 5 insertions(+), 4 deletions(-)
       ---
 (DIR) 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