got_fatal_signal() fix for no sys_siglist

Juran, James (US SSA) james.juran at baesystems.com
Fri Apr 20 21:46:24 CEST 2007


On systems without sys_siglist, got_fatal_signal() will try to convert
the signal number to a printable string.  This works, but it leaves the
variable sig modified, so that when the signal is re-raised it ends up
raising signal 0, which doesn't have the intended effect of ending the
process.

Using a different variable to do the conversion fixes this problem.  I
don't have an svn account, so if this is OK could someone please commit
it?  Please let me know if there's anything else I need to do.

Index: signal.c
===================================================================
--- signal.c	(revision 1942)
+++ signal.c	(working copy)
@@ -114,16 +114,16 @@ got_fatal_signal (int sig)
         write (2, "?", 1);
       else 
         {
-          int i, any=0;
+          int i, any=0, tsig=sig;
 
           for (i=10000; i; i /= 10)
             {
-              if (sig >= i || ((any || i==1) && !(sig/i)))
+              if (tsig >= i || ((any || i==1) && !(tsig/i)))
                 {
-                  write (2, "0123456789"+(sig/i), 1);
-                  if ((sig/i))
+                  write (2, "0123456789"+(tsig/i), 1);
+                  if ((tsig/i))
                     any = 1;
-                  sig %= i;
+                  tsig %= i;
                 }
             }
         }

-- 
James Juran
Senior Secure Systems Analyst
BAE Systems Information Technology
Information Assurance Group
XTS Operating Systems
james.juran at baesystems.com
+1 703-563-8081
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/attachments/20070420/9639acd9/attachment.pgp 


More information about the Gnupg-devel mailing list