rpms/epic/F-13 epic4-2.10-signals.patch,NONE,1.1 epic.spec,1.35,1.36

vcrhonek vcrhonek at fedoraproject.org
Tue Mar 30 11:01:35 UTC 2010


Author: vcrhonek

Update of /cvs/pkgs/rpms/epic/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv14926

Modified Files:
	epic.spec 
Added Files:
	epic4-2.10-signals.patch 
Log Message:
Fix crashes when resizing xterminal window (signals fix)

epic4-2.10-signals.patch:
 irc.c    |    2 -
 ircsig.c |  104 +++++++++++++++++++++++++++++++++++----------------------------
 2 files changed, 59 insertions(+), 47 deletions(-)

--- NEW FILE epic4-2.10-signals.patch ---
diff -up epic4-2.10/source/irc.c.orig epic4-2.10/source/irc.c
--- epic4-2.10/source/irc.c.orig	2008-03-29 05:49:23.000000000 +0100
+++ epic4-2.10/source/irc.c	2010-03-30 12:31:00.894417843 +0200
@@ -1155,7 +1155,7 @@ int 	main (int argc, char *argv[])
 	/* make sure we don't start with spurious signals events firing */
 	memset(&signals_caught, 0, NSIG * sizeof(int));
 	/* hook all signals! */
-	hook_all_signals();
+	init_signals();
 	/* we *might* want to check for SIG_ERR from the above function.
 	 * i leave it to hop to decide what to do on SIG_ERR. -pegasus 
 	 */
diff -up epic4-2.10/source/ircsig.c.orig epic4-2.10/source/ircsig.c
--- epic4-2.10/source/ircsig.c.orig	2008-03-14 01:12:53.000000000 +0100
+++ epic4-2.10/source/ircsig.c	2008-08-09 05:30:25.000000000 +0200
@@ -57,12 +57,13 @@ int	unblock_signal (int sig_no)
 }
 
 /* array of signal handlers containing mostly NULL */
-volatile sigfunc *signal_handlers[NSIG];
+sigfunc *signal_handlers[NSIG];
+volatile int    signals_caught[NSIG];
 
-/* grand unified signal handler, which sets flags for scriptable signals 
- * -pegasus 
+/* grand unified signal handler, which sets flags for scriptable signals
+ * - pegasus
  */
-RETSIGTYPE signal_handler (int sig_no)
+static RETSIGTYPE signal_handler (int sig_no)
 {
 	signals_caught[0] = 1;
 	signals_caught[sig_no]++;
@@ -70,63 +71,74 @@ RETSIGTYPE signal_handler (int sig_no)
 		signal_handlers[sig_no](sig_no);
 }
 
-/* hook_all_signals needs to be called in main() before my_signal()
- * if any signal hooks fail, it returns SIG_ERR, otherwise it returns 
- * NULL. -pegasus
- */
-sigfunc *hook_all_signals (void)
+sigfunc *reset_one_signal (int sig_no, sigfunc *sig_handler)
 {
-        struct sigaction sa, osa;
-	int sig_no;
-	sigfunc *error = NULL;
+	struct sigaction sa, osa;
 
-	/* docs say this is const. if it changes, something else is 
-	 * broken. -pegasus
-	 */
-	sa.sa_handler = &signal_handler;
-	/* end possibly risky code */
-	for (sig_no = 0; sig_no < NSIG; sig_no++)
-	{
-		signal_handlers[sig_no] = NULL;
-		/* this is ugly, but the `correct' way.  i hate c. -mrg */
-		/* moved from my_signal. -pegasus */
-	        sa.sa_flags = 0;
+	if (sig_no < 0)
+		return NULL;			/* Signal not implemented */
+
+	signal_handlers[sig_no] = NULL;
+
+	sa.sa_handler = sig_handler;
+	sigemptyset(&sa.sa_mask);
+	sigaddset(&sa.sa_mask, sig_no);
+
+	/* this is ugly, but the `correct' way.  i hate c. -mrg */
+	sa.sa_flags = 0;
 #if defined(SA_RESTART) || defined(SA_INTERRUPT)
-	        if (SIGALRM == sig_no || SIGINT == sig_no)
-        	{
+	if (SIGALRM == sig_no || SIGINT == sig_no)
+	{
 # if defined(SA_INTERRUPT)
-			sa.sa_flags |= SA_INTERRUPT;
+		sa.sa_flags |= SA_INTERRUPT;
 # endif /* SA_INTERRUPT */
-		}
-		else
-		{
+	}
+	else
+	{
 # if defined(SA_RESTART)
-			sa.sa_flags |= SA_RESTART;
+		sa.sa_flags |= SA_RESTART;
 # endif /* SA_RESTART */
-		}
+	}
 #endif /* SA_RESTART || SA_INTERRUPT */
-		/* if it wasn't for the above code, we could move the
-		 * sigemptyset() and sigaction() calls outside the loop 
-		 * proper. -pegasus
-		 */
-		sigemptyset(&sa.sa_mask);
-		sigaddset(&sa.sa_mask, sig_no);
-		if (0 > sigaction(sig_no, &sa, &osa))
+
+	if (0 > sigaction(sig_no, &sa, &osa))
+		return SIG_ERR;
+
+	return osa.sa_handler;
+}
+
+
+/* hook_all_signals needs to be called in main() before my_signal()
+ * if any signal hooks fail, it returns SIG_ERR, otherwise it returns
+ * NULL. - pegasus
+ */
+sigfunc *	init_signals (void)
+{
+	int sig_no;
+	sigfunc *error = NULL;
+
+	memset(&signals_caught, 0, NSIG * sizeof(int));
+
+	for (sig_no = 0; sig_no < NSIG; sig_no++)
+	{
+		if ((reset_one_signal(sig_no, signal_handler)) == SIG_ERR)
 			error = SIG_ERR;
 	}
 	return error;
 }
 
-sigfunc *my_signal (int sig_no, sigfunc *sig_handler)
+sigfunc *	my_signal (int sig_no, sigfunc *sig_handler)
 {
-        sigfunc *old;
+	sigfunc	*old;
 
-	if (sig_no < 0)
-		return NULL;		/* Signal not implemented */
-
-	/* Well this is certainly simpler. -pegasus */
 	old = signal_handlers[sig_no];
-	signal_handlers[sig_no] = (volatile sigfunc *)sig_handler;
+	if (sig_handler == SIG_IGN || sig_handler == SIG_DFL)
+		reset_one_signal(sig_no, sig_handler);
+	else
+	{
+		reset_one_signal(sig_no, signal_handler);
+		signal_handlers[sig_no] = (sigfunc *)sig_handler;
+	}
 
-        return old;
+	return old;
 }


Index: epic.spec
===================================================================
RCS file: /cvs/pkgs/rpms/epic/F-13/epic.spec,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -p -r1.35 -r1.36
--- epic.spec	21 Aug 2009 13:16:08 -0000	1.35
+++ epic.spec	30 Mar 2010 11:01:34 -0000	1.36
@@ -1,7 +1,7 @@
 Summary: An ircII chat client
 Name: epic
 Version: 2.10
-Release: 6%{?dist}
+Release: 7%{?dist}
 Epoch: 4
 # The entire source code is Freely redistributable without restriction except some
 # files (notably, glob.c, and compat.c) may contain some source covered by BSD
@@ -17,6 +17,8 @@ Source6: http://splitfire.sourceforge.ne
 Source7: http://splitfire.sourceforge.net/schemes/sf-light-scheme.irc.gz
 Source8: http://splitfire.sourceforge.net/schemes/sf-perry-scheme.irc.gz
 Patch0: epic-default.patch
+# Patch1: fixes bz#575190, commited into upstream CVS already
+Patch1: epic4-2.10-signals.patch
 URL: http://www.epicsol.org/
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: openssl-devel,ncurses-devel
@@ -31,6 +33,7 @@ rm -rf $RPM_BUILD_DIR/ircii-EPIC%{prog_v
 
 %setup -q -n epic4-%{version} -a 1
 %patch0 -p0 -b .default
+%patch1 -p1 -b .signals
 
 %build
 %configure
@@ -81,6 +84,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/epic/help/*
 
 %changelog
+* Tue Mar 30 2010 Vitezslav Crhonek <vcrhonek at redhat.com> - 4:2.10-7
+- Fix crashes when resizing xterminal window (signals fix)
+  Resolves: #575190
+
 * Fri Aug 21 2009 Tomas Mraz <tmraz at redhat.com> - 4:2.10-6
 - rebuilt with new openssl
 



More information about the scm-commits mailing list