[libvirt] [PATCH 5/7] qemu: Don't unconditionally delete file in qemuOpenFileAs
Eric Blake
eblake at redhat.com
Thu Jan 29 20:29:14 UTC 2015
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 at redhat.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150129/314113ed/attachment-0001.sig>
More information about the libvir-list
mailing list