Re: [PATCH 2/2] qemu: never unlink() the core dump output file

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

 



On 8/20/21 10:39 AM, Simon Rowe wrote:
> The comment above virQEMUFileOpenAs() implies any result should be
> left intact.
> 
> Signed-off-by: Simon Rowe <simon.rowe@xxxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index f31e13889e..b1ac1cb73b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3282,8 +3282,6 @@ doCoreDump(virQEMUDriver *driver,
>      if (qemuDomainFileWrapperFDClose(vm, wrapperFd) < 0)
>          ret = -1;
>      virFileWrapperFdFree(wrapperFd);
> -    if (ret != 0)
> -        unlink(path);
>      return ret;
>  }
>  
> 

So the @path is opened using virQEMUFileOpenAs() which as the last
argument has @needUnlink which tells caller whether the file was created
by this call (true) or was already existing (false). But for some reason
doCoreDump() passes NULL and then unlinks the file unconditionally. I
think the proper fix would be to introduce a boolean, pass it instead of
NULL and then have:

 if (ret != 0 && needUnlink)
   unlink(path);

Michal




[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]

  Powered by Linux