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".
This commit is contained in:
Stefan Berger 2012-04-27 14:39:17 -04:00 committed by Stefan Berger
parent 002b18b3fb
commit f74471de4f
2 changed files with 3 additions and 3 deletions

View File

@ -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,

View File

@ -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",