aboutsummaryrefslogtreecommitdiffstats
path: root/common/signal.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2007-05-07 19:49:12 +0000
committerWerner Koch <[email protected]>2007-05-07 19:49:12 +0000
commitd5052fd22864ebb879e3b417ecfefd88e6c1800a (patch)
tree82f547df2e3ac98021fd713f470cc00610482c8e /common/signal.c
parentUpdated to automake 1.10. (diff)
downloadgnupg-d5052fd22864ebb879e3b417ecfefd88e6c1800a.tar.gz
gnupg-d5052fd22864ebb879e3b417ecfefd88e6c1800a.zip
Upgraded gettext.
Fixed accidental dependency on libgcrypt 1.3.0.
Diffstat (limited to 'common/signal.c')
-rw-r--r--common/signal.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/common/signal.c b/common/signal.c
index 0c79214b2..1c82014e0 100644
--- a/common/signal.c
+++ b/common/signal.c
@@ -92,9 +92,9 @@ got_fatal_signal (int sig)
const char *s;
if (caught_fatal_sig)
- raise (sig);
+ raise (sig);
caught_fatal_sig = 1;
-
+
if (cleanup_fnc)
cleanup_fnc ();
/* Better don't translate these messages. */
@@ -109,21 +109,25 @@ got_fatal_signal (int sig)
else
{
/* We are in a signal handler so we can't use any kind of printf
- even not sprintf. USe a straightforward algorithm. */
+ even not sprintf. So we use a straightforward algorithm. We
+ got a report that on one particular system, raising a signal
+ while in this handler, the parameter SIG get sclobbered and
+ things are messed up because we modify its value. Although
+ this is a bug in that system, we will protect against it. */
if (sig < 0 || sig >= 100000)
write (2, "?", 1);
else
{
- int i, any=0;
+ int i, value, any=0;
- for (i=10000; i; i /= 10)
+ for (value=sig,i=10000; i; i /= 10)
{
- if (sig >= i || ((any || i==1) && !(sig/i)))
+ if (value >= i || ((any || i==1) && !(value/i)))
{
- write (2, "0123456789"+(sig/i), 1);
- if ((sig/i))
+ write (2, "0123456789"+(value/i), 1);
+ if ((value/i))
any = 1;
- sig %= i;
+ value %= i;
}
}
}