Re: [PATCH 5/7] qemu: Don't unconditionally delete file in qemuOpenFileAs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/28/2015 03:25 PM, John Ferlan wrote:
> If we're expecting to create a file somewhere and that fails for some
> reason during qemuOpenFileAs, then we unlink the path we're attempting
> to create leaving no way to determine what the "existing" privileges,
> protections, or labels are that caused the failure (open, change owner
> and group, change mode, etc)
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 3 +++
>  1 file changed, 3 insertions(+)

ACK.

> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 0174c87..89b54c8 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2899,6 +2899,9 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
>              vfoflags |= VIR_FILE_OPEN_FORCE_OWNER;
>  
>          if (stat(path, &sb) == 0) {
> +            /* It already exists, we don't want to delete it on error */
> +            need_unlink = false;
> +
>              is_reg = !!S_ISREG(sb.st_mode);
>              /* If the path is regular file which exists
>               * already and dynamic_ownership is off, we don't
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]