From af6fca176de13ce84b49ae7a5d80a8590600c8bc Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Sun, 13 Sep 2009 17:46:10 +0000 Subject: Don't use SIGUSR1 to tell dumpcap to exit, use SIGINT: SIGINT is traditionally used for this purpose and using it also prevents the 2 signals the child gets: - the user's Ctrl-C (which is sent as a SIGINT to both *shark and its child dumpcap) - the signal *shark generates to shut down the child from colliding (and running 2 signal handlers in the child). It might be possible for tshark to not send the signal at all when it gets SIGINT, but it doesn't do any harm now. Also, do not call g_log() within the signal handler: doing so can cause aborts (if g_log is being called by the process when the signal comes, the 2nd entrance into g_log is detected as a recursion). This fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2767 svn path=/trunk/; revision=29881 --- capture_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'capture_sync.c') diff --git a/capture_sync.c b/capture_sync.c index 28f2b386c8..2d072fe88c 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -1425,11 +1425,11 @@ sync_pipe_stop(capture_options *capture_opts) if (capture_opts->fork_child != -1) { #ifndef _WIN32 - /* send the SIGUSR1 signal to close the capture child gracefully. */ - int sts = kill(capture_opts->fork_child, SIGUSR1); + /* send the SIGINT signal to close the capture child gracefully. */ + int sts = kill(capture_opts->fork_child, SIGINT); if (sts != 0) { g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_WARNING, - "Sending SIGUSR1 to child failed: %s\n", strerror(errno)); + "Sending SIGINT to child failed: %s\n", strerror(errno)); } #else #define STOP_SLEEP_TIME 500 /* ms */ -- cgit v1.2.3