Make the "-g" argument to tshark actually work (by passing it to dumpcap).

svn path=/trunk/; revision=46515
This commit is contained in:
Jeff Morriss 2012-12-12 03:25:35 +00:00
parent 47efce2889
commit 20211340e5
4 changed files with 18 additions and 10 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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