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

Daniel Veillard veillard at redhat.com
Wed Apr 7 08:25:42 UTC 2010


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 at 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 at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list