mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
Fix exiting of libvirt_lxc program on container quit
The virLXCControllerClientCloseHook method was mistakenly assuming that the private data associated with the network client was the virLXCControllerPtr. In fact it was just a dummy int, so we were derefencing a bogus struct. The frequent result of this was that we would never quit, because we tried to arm a non-existant timer. Fix the code by removing the dummy private data and just using the virLXCControllerPtr instance as private data Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
afbd96678e
commit
37db3f5dfe
@ -578,19 +578,14 @@ static void virLXCControllerClientCloseHook(virNetServerClientPtr client)
|
|||||||
|
|
||||||
static void virLXCControllerClientPrivateFree(void *data)
|
static void virLXCControllerClientPrivateFree(void *data)
|
||||||
{
|
{
|
||||||
VIR_FREE(data);
|
virLXCControllerPtr ctrl = data;
|
||||||
|
VIR_DEBUG("Got private data free %p", ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *virLXCControllerClientPrivateNew(virNetServerClientPtr client,
|
static void *virLXCControllerClientPrivateNew(virNetServerClientPtr client,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
virLXCControllerPtr ctrl = opaque;
|
virLXCControllerPtr ctrl = opaque;
|
||||||
int *dummy;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(dummy) < 0) {
|
|
||||||
virReportOOMError();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
virNetServerClientSetCloseHook(client, virLXCControllerClientCloseHook);
|
virNetServerClientSetCloseHook(client, virLXCControllerClientCloseHook);
|
||||||
VIR_DEBUG("Got new client %p", client);
|
VIR_DEBUG("Got new client %p", client);
|
||||||
@ -600,7 +595,7 @@ static void *virLXCControllerClientPrivateNew(virNetServerClientPtr client,
|
|||||||
virLXCControllerEventSendInit(ctrl, ctrl->initpid);
|
virLXCControllerEventSendInit(ctrl, ctrl->initpid);
|
||||||
ctrl->firstClient = false;
|
ctrl->firstClient = false;
|
||||||
|
|
||||||
return dummy;
|
return ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1327,7 +1322,7 @@ virLXCControllerEventSendExit(virLXCControllerPtr ctrl,
|
|||||||
{
|
{
|
||||||
virLXCProtocolExitEventMsg msg;
|
virLXCProtocolExitEventMsg msg;
|
||||||
|
|
||||||
VIR_DEBUG("Exit status %d", exitstatus);
|
VIR_DEBUG("Exit status %d (client=%p)", exitstatus, ctrl->client);
|
||||||
memset(&msg, 0, sizeof(msg));
|
memset(&msg, 0, sizeof(msg));
|
||||||
switch (exitstatus) {
|
switch (exitstatus) {
|
||||||
case 0:
|
case 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user