Linux Media Controller development
 help / color / mirror / Atom feed
From: "Brian J. Murrell" <brian@interlinx.bc.ca>
To: linux-media@vger.kernel.org
Subject: Re: gnutv should not ignore SIGPIPE
Date: Tue, 29 Nov 2011 09:22:05 -0500	[thread overview]
Message-ID: <jb2pqe$h8d$1@dough.gmane.org> (raw)
In-Reply-To: <jao5l8$v03$1@dough.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

On 11-11-25 08:36 AM, Brian J. Murrell wrote:
> 
> Yes, that is the other way to skin that cat I suppose.

I couldn't figure out what the right thing for writer thread to do to
terminate the application so I used SIGPIPE instead.  Here's the patch:

--- linuxtv-dvb-apps-1.1.1+rev1273~/util/gnutv/gnutv_data.c	2011-11-28 09:10:33.010407011 -0500
+++ linuxtv-dvb-apps-1.1.1+rev1273/util/gnutv/gnutv_data.c	2011-11-28 09:10:26.446258282 -0500
@@ -265,7 +265,10 @@
 		while(written < size) {
 			int tmp = write(outfd, buf + written, size - written);
 			if (tmp == -1) {
-				if (errno != EINTR) {
+				if (errno == EPIPE) {
+					fprintf(stderr, "processing EPIPE\n");
+					return 0;
+				} else if (errno != EINTR) {
 					fprintf(stderr, "Write error: %m\n");
 					break;
 				}
--- linuxtv-dvb-apps-1.1.1+rev1273~/util/gnutv/gnutv.c	2011-11-28 10:13:13.294445131 -0500
+++ linuxtv-dvb-apps-1.1.1+rev1273/util/gnutv/gnutv.c.new	2011-11-28 10:13:10.510492321 -0500
@@ -262,7 +262,7 @@
 
 	// setup any signals
 	signal(SIGINT, signal_handler);
-	signal(SIGPIPE, SIG_IGN);
+	signal(SIGPIPE, signal_handler);
 
 	// start the CA stuff
 	gnutv_ca_params.adapter_id = adapter_id;


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

      reply	other threads:[~2011-11-29 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-25 13:05 gnutv should not ignore SIGPIPE Brian J. Murrell
2011-11-25 13:34 ` Rémi Denis-Courmont
2011-11-25 13:36   ` Brian J. Murrell
2011-11-29 14:22     ` Brian J. Murrell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='jb2pqe$h8d$1@dough.gmane.org' \
    --to=brian@interlinx.bc.ca \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox