[xiph-commits] r14255 - in trunk/ezstream: . src

moritz at svn.xiph.org moritz at svn.xiph.org
Sat Dec 1 08:02:56 PST 2007


Author: moritz
Date: 2007-12-01 08:02:55 -0800 (Sat, 01 Dec 2007)
New Revision: 14255

Modified:
   trunk/ezstream/NEWS
   trunk/ezstream/src/ezstream.c
Log:
Ignore SIGPIPE, which turned out to be the cause for silent deaths of long-
running ezstream processes.


Modified: trunk/ezstream/NEWS
===================================================================
--- trunk/ezstream/NEWS	2007-12-01 09:23:04 UTC (rev 14254)
+++ trunk/ezstream/NEWS	2007-12-01 16:02:55 UTC (rev 14255)
@@ -1,3 +1,11 @@
+Changes in 0.5.3 (SVN):
+
+ * src/ezstream.c:
+   - [FIX]   Prevent (very) long-running ezstream processes from dying without
+             error message by ignoring SIGPIPE where available.
+
+
+
 Changes in 0.5.2, released on 2007-11-04:
 
  * src/ezstream.c:

Modified: trunk/ezstream/src/ezstream.c
===================================================================
--- trunk/ezstream/src/ezstream.c	2007-12-01 09:23:04 UTC (rev 14254)
+++ trunk/ezstream/src/ezstream.c	2007-12-01 16:02:55 UTC (rev 14255)
@@ -132,8 +132,12 @@
 int		ez_shutdown(int);
 
 #ifdef HAVE_SIGNALS
-void	sig_handler(int);
+void		sig_handler(int);
 
+# ifndef SIG_IGN
+#  define SIG_IGN	 (void (*)(int))1
+# endif /* !SIG_IGN */
+
 void
 sig_handler(int sig)
 {
@@ -1250,6 +1254,16 @@
 			return (ez_shutdown(1));
 		}
 	}
+	/*
+	 * Ignore SIGPIPE, which has been seen to give a long-running ezstream
+	 * process trouble. EOF and/or EPIPE are also easier to handle.
+	 */
+	act.sa_handler = SIG_IGN;
+	if (sigaction(SIGPIPE, &act, NULL) == -1) {
+		printf("%s: sigaction(): %s\n",
+		       __progname, strerror(errno));
+		return (ez_shutdown(1));
+	}
 #endif /* HAVE_SIGNALS */
 
 	if (shout_open(shout) == SHOUTERR_SUCCESS) {



More information about the commits mailing list