Make the "-g" argument to tshark actually work (by passing it to dumpcap).
authorJeff Morriss <jeff.morriss.ws@gmail.com>
Wed, 12 Dec 2012 03:25:35 +0000 (03:25 -0000)
committerJeff Morriss <jeff.morriss.ws@gmail.com>
Wed, 12 Dec 2012 03:25:35 +0000 (03:25 -0000)
svn path=/trunk/; revision=46515

capture_opts.c
capture_sync.c
dumpcap.c
tshark.c

index 52e5e6429a1a580716b1a88bf7c2b3f32e35d3bc..65e848d2e0e1eef36d662e89123893a58c2ee5cf 100644 (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;
 
index eed62c47643c5c011dcc8042cc5ced1177a18e61..1020f18fdb6d9bfa43f553a7628779e77e5655f4 100644 (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);
 
index be59fcef7b6b335c29c3021c33c6c88ce3cc6ef3..e88e0598f4c21648ff00996180931ac83c90cc2b 100644 (file)
--- 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 */
index bc4f02612bc141640e053fd2ec2ef839dbabdc00..fd8e6e6e23aaae9ed33dc947c7aa9a6874042aca 100644 (file)
--- 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