It is a complete mistake to have *ANY* messages during packet capture
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 Feb 2012 03:57:49 +0000 (03:57 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 Feb 2012 03:57:49 +0000 (03:57 +0000)
sent to the standard output if "-w" is specified because, when you
capture, you can capture with the output directed to the standard
output, and dumping some text crap to the standard output will corrupt
your capture file.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40966 f5534014-38df-0310-8fa8-9805f1628bb7

tshark.c

index 296ab4a5ff7c3123c3435f144de8515ba32a8f96..efe2936d7388f4da201ac2ca74bb584cb35cf77c 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -756,16 +756,12 @@ print_current_user(void) {
     cur_group = get_cur_groupname();
     fprintf(stderr, "Running as user \"%s\" and group \"%s\".",
       cur_user, cur_group);
-    if (running_with_special_privs()) {
-      fprintf(stderr, "Running as user \"%s\" and group \"%s\". This could be dangerous.\n",
-         cur_user, cur_group);
-    }
-    else {
-      fprintf(stdout, "Running as user \"%s\" and group \"%s\".",
-         cur_user, cur_group);
-    }
     g_free(cur_user);
     g_free(cur_group);
+    if (running_with_special_privs()) {
+      fprintf(stderr, " This could be dangerous.");
+    }
+    fprintf(stderr, "\n");
   }
 }
 
@@ -2114,7 +2110,7 @@ capture(void)
   } else {
     g_string_append_printf(str, "%u interfaces", global_capture_opts.ifaces->len);
   }
-  fprintf(stdout, "Capturing on %s\n", str->str);
+  fprintf(stderr, "Capturing on %s\n", str->str);
   g_string_free(str, TRUE);
 
   ret = sync_pipe_start(&global_capture_opts);
@@ -2373,7 +2369,7 @@ report_counts(void)
   if (!print_packet_counts) {
     /* Report the count only if we aren't printing a packet count
        as packets arrive. */
-    fprintf(stdout, "%u packet%s captured\n", packet_count,
+    fprintf(stderr, "%u packet%s captured\n", packet_count,
             plurality(packet_count, "", "s"));
   }
 #ifdef SIGINFO