res_stir_shaken: refactor utility function

Refactors temp file utility function into file.c.

ASTERISK-29809 #close

Change-Id: Ife478708c8f2b127239cb73c1755ef18c0bf431b
This commit is contained in:
Naveen Albert
2021-12-16 19:41:56 +00:00
committed by Kevin Harwell
parent 19481fc1f0
commit 4cb4a3ed01
3 changed files with 41 additions and 34 deletions

View File

@@ -146,6 +146,23 @@ int ast_filecopy(const char *oldname, const char *newname, const char *fmt);
*/
FILE *ast_file_mkftemp(char *template, mode_t mode);
/*!
* \brief Create a temporary file located at path
*
* \note The directory containing path will be created if it does not exist
* \note This function assumes path does not end with a '/'
*
* \param path The directory path to create the file in
* \param filename Function allocates memory and stores full filename (including path) here
* \param template_name mkstemp template to use. Must end with XXXXXX.
*
* \note filename will need to be freed with ast_free if this function succeeds
*
* \retval -1 on failure
* \return file descriptor on success
*/
int ast_file_fdtemp(const char *path, char **filename, const char *template_name);
/*!
* \brief Callback called for each file found when reading directories
* \param dir_name the name of the directory