[systemd-devel] [PATCH]fopen_temporary: close fd if fail
Daniel Mack
daniel at zonque.org
Thu Jul 9 07:42:17 PDT 2015
On 07/09/2015 01:52 AM, cee1 wrote:
> From 76a7f141d54428af3019732c0fce146f9a6f6394 Mon Sep 17 00:00:00 2001
> From: cee1 <fykcee1 at gmail.com>
> Date: Thu, 9 Jul 2015 12:06:59 +0800
> Subject: [PATCH] basic/util.c fopen_temporary(): close fd if failed
>
> ---
> src/basic/util.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/basic/util.c b/src/basic/util.c
> index e4e302a..c88cd1d 100644
> --- a/src/basic/util.c
> +++ b/src/basic/util.c
> @@ -2535,6 +2535,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) {
> if (!f) {
> unlink(t);
> free(t);
> + safe_close(fd);
> return -errno;
> }
>
Applied, thanks!
Next time, please consider opening a GitHub pull request for patches.
Thanks,
Daniel
More information about the systemd-devel
mailing list