aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2019-09-01 14:37:38 -0400
committerRoland Knall <rknall@gmail.com>2019-12-20 19:26:38 +0000
commit2925fb0850ee3ab005dd02d69994390827c2e008 (patch)
tree94813abb14d09312998be4ac497302fb32ddb7f7 /dumpcap.c
parentc247a8351f4d2be224e8cc424e104d8823450f5d (diff)
Use g_file_open_tmp within create_tempfile
Much better to use a known library than create it ourselves. Also remove get_tempfile_path as it's not used. Bug: 15992 Change-Id: I17b9bd879e8bdb540f79db83c6c138f8ee724764 Reviewed-on: https://code.wireshark.org/review/34420 Reviewed-by: Tomasz Moń <desowin@gmail.com> Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 8714b3829e..6fe9f4887c 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -3428,10 +3428,10 @@ static gboolean
capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
char *errmsg, int errmsg_len)
{
- char *tmpname;
gchar *capfile_name;
gchar *prefix, *suffix;
gboolean is_tempfile;
+ GError *err_tempfile = NULL;
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_open_output: %s",
(capture_opts->save_file) ? capture_opts->save_file : "(not specified)");
@@ -3556,9 +3556,8 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
} else {
suffix = ".pcap";
}
- *save_file_fd = create_tempfile(&tmpname, prefix, suffix);
+ *save_file_fd = create_tempfile(&capfile_name, prefix, suffix, &err_tempfile);
g_free(prefix);
- capfile_name = g_strdup(tmpname);
is_tempfile = TRUE;
}
@@ -3567,7 +3566,8 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
if (is_tempfile) {
g_snprintf(errmsg, errmsg_len,
"The temporary file to which the capture would be saved (\"%s\") "
- "could not be opened: %s.", capfile_name, g_strerror(errno));
+ "could not be opened: %s.", capfile_name, err_tempfile->message);
+ g_error_free(err_tempfile);
} else {
if (capture_opts->multi_files_on) {
/* Ensures that the ringbuffer is not used. This ensures that