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

Re: [libvirt] [PATCH] qemu_driver.c: don't close an arbitrary file descriptor



On Wed, Apr 07, 2010 at 09:20:39AM +0200, Jim Meyering wrote:
> clang spotted this:
> 
> An early failure makes us "goto" the cleanup code
> that tests (and probably closes) the "logfile" fd.
> 
> >From 49e46a427832681b686b712fbfbc24a312c286c1 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Wed, 7 Apr 2010 09:17:27 +0200
> Subject: [PATCH] qemu_driver.c: don't close an arbitrary file descriptor
> 
> * src/qemu/qemu_driver.c (qemudStartVMDaemon): Initialize "logfile"
> to ensure that we don't use it uninitialized -- thus closing an
> arbitrary file descriptor -- in the cleanup block.
> ---
>  src/qemu/qemu_driver.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ce43fd3..60fa95a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3159,7 +3159,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
>      int pos = -1;
>      char ebuf[1024];
>      char *pidfile = NULL;
> -    int logfile;
> +    int logfile = -1;
>      qemuDomainObjPrivatePtr priv = vm->privateData;
> 
>      struct qemudHookData hookData;

  ACK,

thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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