From f74471de4fe03eb79d670dc5c6e1191ba15b0766 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 27 Apr 2012 14:39:17 -0400 Subject: [PATCH] lxc: Fix coverity findings Error: UNINIT: /libvirt/src/lxc/lxc_driver.c:1412: var_decl: Declaring variable "fd" without initializer. /libvirt/src/lxc/lxc_driver.c:1460: uninit_use_in_call: Using uninitialized value "fd" when calling "virFileClose". /libvirt/src/util/virfile.c:50: read_parm: Reading a parameter value. Error: DEADCODE: /libvirt/src/lxc/lxc_controller.c:960: dead_error_condition: On this path, the condition "ret == 4" cannot be true. /libvirt/src/lxc/lxc_controller.c:959: at_most: After this line, the value of "ret" is at most -1. /libvirt/src/lxc/lxc_controller.c:959: new_values: Noticing condition "ret < 0". /libvirt/src/lxc/lxc_controller.c:961: dead_error_line: Execution cannot reach this statement "continue;". Error: UNINIT: /libvirt/src/lxc/lxc_controller.c:1104: var_decl: Declaring variable "consoles" without initializer. /libvirt/src/lxc/lxc_controller.c:1237: uninit_use: Using uninitialized value "consoles". --- src/lxc/lxc_controller.c | 4 ++-- src/lxc/lxc_driver.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index bbc9d9c12c..26174232da 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -957,7 +957,7 @@ static void lxcEpollIO(int watch, int fd, int events, void *opaque) int ret; ret = epoll_wait(console->epollFd, &event, 1, 0); if (ret < 0) { - if (ret == EINTR) + if (errno == EINTR) continue; virReportSystemError(errno, "%s", _("Unable to wait on epoll")); @@ -1101,7 +1101,7 @@ static int lxcControllerMain(int serverFd, size_t nFds, pid_t container) { - struct lxcConsole *consoles; + struct lxcConsole *consoles = NULL; struct lxcMonitor monitor = { .serverFd = serverFd, .clientFd = clientFd, diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 909b8e8a76..7e7affd75a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1409,7 +1409,7 @@ static int lxcMonitorClient(lxc_driver_t * driver, virDomainObjPtr vm) { char *sockpath = NULL; - int fd; + int fd = -1; struct sockaddr_un addr; if (virAsprintf(&sockpath, "%s/%s.sock",