[pacman-dev] [PATCH] Move creating a temporary directory into a utility function

Allan McRae allan at archlinux.org
Wed Jan 8 05:42:31 UTC 2020


On 8/1/20 1:45 pm, Allan McRae wrote:
> ---
> 
> This will be used for downloading sync directories into a temporary location
> so they can be validated before replacing exisiting sync dbs.
> 
>  lib/libalpm/trans.c | 11 +----------
>  lib/libalpm/util.c  | 28 ++++++++++++++++++++++++++++
>  lib/libalpm/util.h  |  1 +
>  3 files changed, 30 insertions(+), 10 deletions(-)
> 
<snip>

> +/** Creates a temporary directory of form /$root/tmp/alpm_XXXXXX.
> + * @param handle the context handle
> + * @param tmpdir pointer to storage of created directory path
> + * @return path length on success, 0 on error
> + */
> +int _alpm_mkdtemp(alpm_handle_t *handle, char **tmpdir)
> +{
> +	size_t len;
> +
> +	ASSERT(tmpdir, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, 0));

Reviewing my own patch...

ASSERT(tmpdir != NULL, ....)


More information about the pacman-dev mailing list