[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/2] qga: unlink just created guest-file if f
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/2] qga: unlink just created guest-file if fchmod() or fdopen() fails on it |
Date: |
Wed, 08 May 2013 11:07:29 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 05/08/2013 09:31 AM, Laszlo Ersek wrote:
> We shouldn't allow guest filesystem pollution on error paths.
>
> Suggested-by: Eric Blake <address@hidden>
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
> qga/commands-posix.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 2eec712..e199738 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -355,6 +355,9 @@ safe_open_or_create(const char *path, const char *mode,
> Error **err)
> }
>
> close(fd);
> + if (oflag & O_CREAT) {
> + unlink(path);
> + }
> }
> }
>
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature