From 20211340e51fd11809cf08317c23d1bcc54f663d Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Wed, 12 Dec 2012 03:25:35 +0000 Subject: [PATCH] Make the "-g" argument to tshark actually work (by passing it to dumpcap). svn path=/trunk/; revision=46515 --- capture_opts.c | 18 +++++++++++------- capture_sync.c | 4 ++++ dumpcap.c | 2 +- tshark.c | 4 ++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/capture_opts.c b/capture_opts.c index 52e5e6429a..65e848d2e0 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -692,6 +692,9 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_ capture_opts->default_options.cfilter = g_strdup(optarg_str_p); } break; + case 'g': /* enable group read access on the capture file(s) */ + capture_opts->group_read_access = TRUE; + break; case 'H': /* Hide capture info dialog box */ capture_opts->show_info = FALSE; break; @@ -803,9 +806,6 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_ capture_opts->save_file = g_strdup(optarg_str_p); status = capture_opts_output_to_pipe(capture_opts->save_file, &capture_opts->output_to_pipe); return status; - case 'g': /* enable group read access on the capture file(s) */ - capture_opts->group_read_access = TRUE; - break; case 'y': /* Set the pcap data link type */ if (capture_opts->ifaces->len > 0) { interface_options interface_opts; @@ -887,7 +887,8 @@ capture_opts_print_interfaces(GList *if_list) } -void capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min) +void +capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min) { guint i; interface_options interface_opts; @@ -911,7 +912,8 @@ void capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min) } -void capture_opts_trim_ring_num_files(capture_options *capture_opts) +void +capture_opts_trim_ring_num_files(capture_options *capture_opts) { /* Check the value range of the ring_num_files parameter */ if (capture_opts->ring_num_files > RINGBUFFER_MAX_NUM_FILES) { @@ -957,7 +959,8 @@ capture_opts_trim_iface(capture_options *capture_opts, const char *capture_devic #endif /* copied from filesystem.c */ -static int capture_opts_test_for_fifo(const char *path) +static int +capture_opts_test_for_fifo(const char *path) { ws_statb64 statb; @@ -970,7 +973,8 @@ static int capture_opts_test_for_fifo(const char *path) return 0; } -static gboolean capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe) +static gboolean +capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe) { int err; diff --git a/capture_sync.c b/capture_sync.c index eed62c4764..1020f18fdb 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -430,6 +430,10 @@ sync_pipe_start(capture_options *capture_opts) { argv = sync_pipe_add_arg(argv, &argc, sautostop_duration); } + if (capture_opts->group_read_access) { + argv = sync_pipe_add_arg(argv, &argc, "-g"); + } + for (j = 0; j < capture_opts->ifaces->len; j++) { interface_opts = g_array_index(capture_opts->ifaces, interface_options, j); diff --git a/dumpcap.c b/dumpcap.c index be59fcef7b..e88e0598f4 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -4453,7 +4453,7 @@ main(int argc, char *argv[]) case 'b': /* Ringbuffer option */ case 'c': /* Capture x packets */ case 'f': /* capture filter */ - case 'g': /* enable group read accesson file(s) */ + case 'g': /* enable group read access on file(s) */ case 'i': /* Use interface x */ case 'n': /* Use pcapng format */ case 'p': /* Don't capture in promiscuous mode */ diff --git a/tshark.c b/tshark.c index bc4f02612b..fd8e6e6e23 100644 --- a/tshark.c +++ b/tshark.c @@ -923,7 +923,7 @@ main(int argc, char *argv[]) #define OPTSTRING_I "" #endif -#define OPTSTRING "2a:" OPTSTRING_A "b:" OPTSTRING_B "c:C:d:De:E:f:F:G:hH:i:" OPTSTRING_I "K:lLnN:o:O:pPqr:R:s:S:t:T:u:vVw:W:xX:y:z:" +#define OPTSTRING "2a:" OPTSTRING_A "b:" OPTSTRING_B "c:C:d:De:E:f:F:gG:hH:i:" OPTSTRING_I "K:lLnN:o:O:pPqr:R:s:S:t:T:u:vVw:W:xX:y:z:" static const char optstring[] = OPTSTRING; @@ -1186,7 +1186,7 @@ main(int argc, char *argv[]) case 'b': /* Ringbuffer option */ case 'c': /* Capture x packets */ case 'f': /* capture filter */ - case 'g': /* enable group read accesson file(s) */ + case 'g': /* enable group read access on file(s) */ case 'i': /* Use interface x */ case 'p': /* Don't capture in promiscuous mode */ #ifdef HAVE_PCAP_REMOTE