Use appropriate temporary filename when capturing from multiple interfaces.
authortuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 21 May 2011 20:57:00 +0000 (20:57 +0000)
committertuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 21 May 2011 20:57:00 +0000 (20:57 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37344 f5534014-38df-0310-8fa8-9805f1628bb7

dumpcap.c

index 56529dc79da7fc55e17e27e2ac0e507d0a62c737..17946b6d12c24ebfba6f41ed5b419593e1f20a75 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -2859,15 +2859,19 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
         is_tempfile = FALSE;
     } else {
         /* Choose a random name for the temporary capture buffer */
+        if (global_capture_opts.ifaces->len > 1) {
+            prefix = g_strdup_printf("wireshark_%d_interfaces", global_capture_opts.ifaces->len);
+        } else {
 #ifdef _WIN32
-        GString *iface;
+            GString *iface;
 
-        iface = isolate_uuid(g_array_index(global_capture_opts.ifaces, interface_options, global_capture_opts.ifaces->len - 1).name);
-        prefix = g_strconcat("wireshark_", g_basename(iface->str), NULL);
-        g_string_free(iface, TRUE);
+            iface = isolate_uuid(g_array_index(global_capture_opts.ifaces, interface_options, 0).name);
+            prefix = g_strconcat("wireshark_", g_basename(iface->str), NULL);
+            g_string_free(iface, TRUE);
 #else
-        prefix = g_strconcat("wireshark_", g_basename(g_array_index(global_capture_opts.ifaces, interface_options, global_capture_opts.ifaces->len - 1).name), NULL);
+            prefix = g_strconcat("wireshark_", g_basename(g_array_index(global_capture_opts.ifaces, interface_options, 0).name), NULL);
 #endif
+        }
         *save_file_fd = create_tempfile(&tmpname, prefix);
         g_free(prefix);
         capfile_name = g_strdup(tmpname);