summaryrefslogtreecommitdiff
path: root/dumpcap.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-05-29 13:52:19 -0400
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2016-06-01 06:24:05 +0000
commitacc018b8d1db3489d3f63f8f096c593243191469 (patch)
treee7adc7f2ffe56a94550c7def88de4cc8f50d9ac8 /dumpcap.c
parentb2845a6ac885d49aa1ea5d3865cd377d812eb4c7 (diff)
downloadwireshark-acc018b8d1db3489d3f63f8f096c593243191469.tar.gz
Allow create_tempfile to support a suffix.
Ping-Bug: 10203 Change-Id: Ifa24870d711449b87e9839dd46af614e4aa28fde Reviewed-on: https://code.wireshark.org/review/15608 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 21230b7ec7..c38cf63da8 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -2733,7 +2733,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
{
char *tmpname;
gchar *capfile_name;
- gchar *prefix;
+ gchar *prefix, *suffix;
gboolean is_tempfile;
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_open_output: %s",
@@ -2787,6 +2787,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
/* 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);
+ suffix = NULL;
} else {
gchar *basename;
basename = g_path_get_basename(g_array_index(global_capture_opts.ifaces, interface_options, 0).console_display_name);
@@ -2802,17 +2803,17 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
g_string_free(iface, TRUE);
}
#endif
- /* generate the temp file name prefix...
- * It would be nice if we could specify a pcapng/pcap filename suffix,
- * create_tempfile() however currently uses mkstemp() which doesn't allow this - one day perhaps*/
+ /* generate the temp file name prefix and suffix */
if (capture_opts->use_pcapng) {
- prefix = g_strconcat("wireshark_pcapng_", basename, NULL);
+ prefix = g_strconcat("wireshark_", basename, NULL);
+ suffix = ".pcapng";
}else{
- prefix = g_strconcat("wireshark_pcap_", basename, NULL);
+ prefix = g_strconcat("wireshark_", basename, NULL);
+ suffix = ".pcap";
}
g_free(basename);
}
- *save_file_fd = create_tempfile(&tmpname, prefix);
+ *save_file_fd = create_tempfile(&tmpname, prefix, suffix);
g_free(prefix);
capfile_name = g_strdup(tmpname);
is_tempfile = TRUE;