]> git.samba.org - metze/wireshark/wip.git/commitdiff
Set SIGPIPE handler every time the program starts.
authorBalint Reczey <balint.reczey@ericsson.com>
Sun, 31 May 2009 18:38:28 +0000 (18:38 -0000)
committerBalint Reczey <balint.reczey@ericsson.com>
Sun, 31 May 2009 18:38:28 +0000 (18:38 -0000)
This hopefully fixes bug 1740.

svn path=/trunk/; revision=28549

dumpcap.c

index 8663fbd4819091a250d88fc5bf540120cc833bec..bb05b0078dd1ac0b59d7bc4a3231eb8a1d9ebde0 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -419,9 +419,6 @@ print_statistics_loop(gboolean machine_readable)
     pcap_t      *pch;
     char        errbuf[PCAP_ERRBUF_SIZE];
     struct pcap_stat ps;
-#ifndef _WIN32
-    struct sigaction act;
-#endif 
 
     if_list = get_interface_list(&err, &err_str);
     if (if_list == NULL) {
@@ -464,14 +461,6 @@ print_statistics_loop(gboolean machine_readable)
             "Dropped");
     }
 
-#ifndef _WIN32
-    /* handle SIGPIPE signal to default action */
-    act.sa_handler = SIG_DFL;
-    sigemptyset(&act.sa_mask);
-    act.sa_flags = SA_RESTART;
-    sigaction(SIGPIPE,&act,NULL);
-#endif 
-
     global_ld.go = TRUE;
     while (global_ld.go) {
         for (stat_entry = g_list_first(stat_list); stat_entry != NULL; stat_entry = g_list_next(stat_entry)) {
@@ -2629,6 +2618,7 @@ main(int argc, char *argv[])
   sigemptyset(&action.sa_mask);
   sigaction(SIGTERM, &action, NULL);
   sigaction(SIGINT, &action, NULL);
+  sigaction(SIGPIPE, &action, NULL);
   sigaction(SIGHUP, NULL, &oldaction);
   if (oldaction.sa_handler == SIG_DFL)
     sigaction(SIGHUP, &action, NULL);