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: signature.asc
Description: OpenPGP digital signature

Reply via email to