]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc_controller: Initialize ctrl->handshakeFd properly
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Apr 2021 08:36:09 +0000 (10:36 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Apr 2021 11:52:21 +0000 (13:52 +0200)
The lxc_controller has a structure that's keeping its internal
state, including so called handshakeFd which is the write end of
a pipe that's used to signal to the LXC driver that the container
is set up and ready to run. However, the struct member is not
initialized to -1, so if anything fails before it is set then the
virLXCControllerFree() function tries to close FD 0 (stdin).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/lxc/lxc_controller.c

index ab5fc8b88f3df433d1544dc17ea1e3080c812b4a..50b2987d9ad3623fc3f9d0397904aa7653063a62 100644 (file)
@@ -193,8 +193,8 @@ static virLXCController *virLXCControllerNew(const char *name)
 
     ctrl->timerShutdown = -1;
     ctrl->firstClient = true;
-
     ctrl->name = g_strdup(name);
+    ctrl->handshakeFd = -1;
 
     if (!(driver = virLXCControllerDriverNew()))
         goto error;