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

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



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;
--
1.7.0.4.552.gc303


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