summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2007-05-07 21:49:12 +0200
committerWerner Koch <wk@gnupg.org>2007-05-07 21:49:12 +0200
commitd5052fd22864ebb879e3b417ecfefd88e6c1800a (patch)
tree82f547df2e3ac98021fd713f470cc00610482c8e /common
parentUpdated to automake 1.10. (diff)
downloadgnupg2-d5052fd22864ebb879e3b417ecfefd88e6c1800a.tar.xz
gnupg2-d5052fd22864ebb879e3b417ecfefd88e6c1800a.zip
Upgraded gettext.
Fixed accidental dependency on libgcrypt 1.3.0.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog5
-rw-r--r--common/signal.c22
2 files changed, 18 insertions, 9 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index b458bdd5c..797f11962 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-07 Werner Koch <wk@g10code.com>
+
+ * signal.c (got_fatal_signal): Protect SIG from being clobbered by
+ a faulty signal implementaion. Suggested by James Juran.
+
2007-04-25 Werner Koch <wk@g10code.com>
* i18n.h (ngettext): New.
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;
}
}
}