- Include upstream's patch for signal.c.

This commit is contained in:
Michael Schwendt 2005-05-13 13:10:18 +00:00
parent 1b9fecc817
commit 43dda389a6
3 changed files with 79 additions and 22 deletions

View File

@ -0,0 +1,74 @@
diff -Nur gnupg-1.9.16-orig/common/signal.c gnupg-1.9.16/common/signal.c
--- gnupg-1.9.16-orig/common/signal.c 2004-12-21 11:03:00.000000000 +0100
+++ gnupg-1.9.16/common/signal.c 2005-05-13 14:56:37.000000000 +0200
@@ -1,5 +1,6 @@
/* signal.c - signal handling
- * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002,
+ * 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -73,10 +74,12 @@
static const char *
get_signal_name( int signum )
{
-#if defined(SYS_SIGLIST_DECLARED) && defined(NSIG)
+ /* Note that we can't use strsignal(), because it is not
+ reentrant. */
+#if defined(HAVE_DECL_SYS_SIGLIST) && defined(NSIG)
return (signum >= 0 && signum < NSIG) ? sys_siglist[signum] : "?";
#else
- return "some signal";
+ return NULL;
#endif
}
#endif /*!HAVE_DOSISH_SYSTEM*/
@@ -93,19 +96,42 @@
if (cleanup_fnc)
cleanup_fnc ();
- /* better don't translate these messages */
+ /* Better don't translate these messages. */
write (2, "\n", 1 );
s = log_get_prefix (NULL);
if (s)
write(2, s, strlen (s));
- write (2, ": ", 2 );
+ write (2, ": signal ", 9 );
s = get_signal_name(sig);
- write (2, s, strlen(s) );
+ if (s)
+ write (2, s, strlen(s) );
+ else
+ {
+ /* We are in a signal handler so we can't use any kind of printf
+ even not sprintf. USe a straightforward algorithm. */
+ if (sig < 0 || sig >= 100000)
+ write (2, "?", 1);
+ else
+ {
+ int i, any=0;
+
+ for (i=10000; i; i /= 10)
+ {
+ if (sig >= i || ((any || i==1) && !(sig/i)))
+ {
+ write (2, "0123456789"+(sig/i), 1);
+ if ((sig/i))
+ any = 1;
+ sig %= i;
+ }
+ }
+ }
+ }
write (2, " caught ... exiting\n", 20);
- /* reset action to default action and raise signal again */
+ /* Reset action to default action and raise signal again */
init_one_signal (sig, SIG_DFL, 0);
- /* fixme: remove_lockfiles ();*/
+ /* Fixme: remove_lockfiles ();*/
#ifdef __riscos__
close_fds ();
#endif /* __riscos__ */

View File

@ -1,20 +0,0 @@
diff -Nur gnupg-1.9.16-orig/common/signal.c gnupg-1.9.16/common/signal.c
--- gnupg-1.9.16-orig/common/signal.c 2004-12-21 11:03:00.000000000 +0100
+++ gnupg-1.9.16/common/signal.c 2005-05-10 07:55:06.000000000 +0200
@@ -73,12 +73,12 @@
static const char *
get_signal_name( int signum )
{
-#if defined(SYS_SIGLIST_DECLARED) && defined(NSIG)
- return (signum >= 0 && signum < NSIG) ? sys_siglist[signum] : "?";
-#else
- return "some signal";
-#endif
+ const char* tmp = strsignal(signum);
+ if (tmp)
+ return tmp;
+ else
+ return "some signal";
}
#endif /*!HAVE_DOSISH_SYSTEM*/

View File

@ -1,7 +1,7 @@
Summary: GNU utility for secure communication and data storage
Name: gnupg2
Version: 1.9.16
Release: 2%{?dist}
Release: 3%{?dist}
License: GPL
Group: Applications/System
Source0: ftp://ftp.gnupg.org/gcrypt/alpha/gnupg/gnupg-%{version}.tar.bz2
@ -10,7 +10,7 @@ URL: http://www.gnupg.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: gnupg-1.9.16-pth.patch
Patch1: gnupg-1.9.16-strsignal.patch
Patch1: gnupg-1.9.16-signal-info.patch
Patch2: gnupg-1.9.16-testverbose.patch
Obsoletes: newpg < 0.9.5
@ -132,6 +132,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Fri May 13 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 1.9.16-3
- Include upstream's patch for signal.c.
* Tue May 10 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 1.9.16-1
- Merge changes from Rex's 1.9.16-1 (Thu Apr 21):
- opensc support unconditional