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 /wsutil/tempfile.h | |
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 'wsutil/tempfile.h')
-rw-r--r-- | wsutil/tempfile.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/wsutil/tempfile.h b/wsutil/tempfile.h index 6f20c2fbf4..0565abbb0d 100644 --- a/wsutil/tempfile.h +++ b/wsutil/tempfile.h @@ -22,27 +22,18 @@ extern "C" { */ /** - * Construct the path name of a file in the appropriate temporary - * file directory. - * - * @param filename the file name to be given to the file. - * @return the pathname of the file, g_malloced so the caller - * should g_free it. - */ -WS_DLL_PUBLIC char *get_tempfile_path(const char *filename); - -/** * Create a tempfile with the given prefix (e.g. "wireshark"). The path - * is created using g_get_tmp_dir and mkstemp. + * is created using g_file_open_tmp. * * @param namebuf [in,out] If not NULL, receives the full path of the temp file. - * Must NOT be freed. + * Must be freed. * @param pfx [in] A prefix for the temporary file. * @param sfx [in] A file extension for the temporary file. NULL can be passed * if no file extension is needed + * @param sfx [out] Any error returned by g_file_open_tmp. May be NULL. * @return The file descriptor of the new tempfile, from mkstemps(). */ -WS_DLL_PUBLIC int create_tempfile(char **namebuf, const char *pfx, const char *sfx); +WS_DLL_PUBLIC int create_tempfile(gchar **namebuf, const char *pfx, const char *sfx, GError **err); #ifdef __cplusplus } |