diff options
author | Michael Mann <mmann78@netscape.net> | 2019-09-01 14:37:38 -0400 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-12-20 19:26:38 +0000 |
commit | 2925fb0850ee3ab005dd02d69994390827c2e008 (patch) | |
tree | 94813abb14d09312998be4ac497302fb32ddb7f7 /ui/export_pdu_ui_utils.c | |
parent | c247a8351f4d2be224e8cc424e104d8823450f5d (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 'ui/export_pdu_ui_utils.c')
-rw-r--r-- | ui/export_pdu_ui_utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/export_pdu_ui_utils.c b/ui/export_pdu_ui_utils.c index c9e40b7a24..febf541629 100644 --- a/ui/export_pdu_ui_utils.c +++ b/ui/export_pdu_ui_utils.c @@ -34,12 +34,17 @@ static void exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data) { int import_file_fd; - char *tmpname, *capfile_name, *comment; + char *capfile_name, *comment; int err; /* Choose a random name for the temporary import buffer */ - import_file_fd = create_tempfile(&tmpname, "Wireshark_PDU_", NULL); - capfile_name = g_strdup(tmpname); + GError *err_tempfile = NULL; + import_file_fd = create_tempfile(&capfile_name, "Wireshark_PDU_", NULL, &err_tempfile); + if (import_file_fd < 0) { + failure_alert_box("Temporary file could not be created: %s", err_tempfile->message); + g_error_free(err_tempfile); + goto end; + } comment = g_strdup_printf("Dump of PDUs from %s", cfile.filename); err = exp_pdu_open(exp_pdu_tap_data, import_file_fd, comment); |