Don't call pcap_breakloop() if we're not capturing anything. Fixes a
crash found by Stig. Add debugging output to capture_cleanup_handler() on non-Windows systems. svn path=/trunk/; revision=37417
This commit is contained in:
parent
c1b210c23c
commit
093fce7576
17
dumpcap.c
17
dumpcap.c
|
@ -1365,7 +1365,7 @@ capture_cleanup_handler(DWORD dwCtrlType)
|
|||
}
|
||||
#else
|
||||
static void
|
||||
capture_cleanup_handler(int signum _U_)
|
||||
capture_cleanup_handler(int signum)
|
||||
{
|
||||
/* On UN*X, we cleanly shut down the capture on SIGINT, SIGHUP, and
|
||||
SIGTERM. We assume that if the user wanted it to keep running
|
||||
|
@ -1376,6 +1376,11 @@ capture_cleanup_handler(int signum _U_)
|
|||
* the "recursion" and abort.
|
||||
*/
|
||||
|
||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_INFO,
|
||||
"Console: Control signal");
|
||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
|
||||
"Console: Control signal %d", signum);
|
||||
|
||||
capture_loop_stop();
|
||||
}
|
||||
#endif
|
||||
|
@ -3482,10 +3487,12 @@ static void capture_loop_stop(void)
|
|||
guint i;
|
||||
pcap_options *pcap_opts;
|
||||
|
||||
for (i = 0; i < global_ld.pcaps->len; i++) {
|
||||
pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, i);
|
||||
if (pcap_opts->pcap_h != NULL)
|
||||
pcap_breakloop(pcap_opts->pcap_h);
|
||||
if (global_ld.pcaps) {
|
||||
for (i = 0; i < global_ld.pcaps->len; i++) {
|
||||
pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, i);
|
||||
if (pcap_opts->pcap_h != NULL)
|
||||
pcap_breakloop(pcap_opts->pcap_h);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
global_ld.go = FALSE;
|
||||
|
|
Loading…
Reference in New Issue