lxc: Don't crash if no security driver is specified in libvirt_lxc

When no security driver is specified libvirt_lxc segfaults as a debug
message tries to access security labels for the container that are not
present.

This problem was introduced in commit 6c3cf57d6c.
This commit is contained in:
Peter Krempa 2012-11-26 15:17:58 +01:00
parent 81efb13b4a
commit 99a388e612

View File

@ -1612,11 +1612,15 @@ int main(int argc, char *argv[])
false, false, false))) false, false, false)))
goto cleanup; goto cleanup;
VIR_DEBUG("Security model %s type %s label %s imagelabel %s", if (ctrl->def->seclabels) {
NULLSTR(ctrl->def->seclabels[0]->model), VIR_DEBUG("Security model %s type %s label %s imagelabel %s",
virDomainSeclabelTypeToString(ctrl->def->seclabels[0]->type), NULLSTR(ctrl->def->seclabels[0]->model),
NULLSTR(ctrl->def->seclabels[0]->label), virDomainSeclabelTypeToString(ctrl->def->seclabels[0]->type),
NULLSTR(ctrl->def->seclabels[0]->imagelabel)); NULLSTR(ctrl->def->seclabels[0]->label),
NULLSTR(ctrl->def->seclabels[0]->imagelabel));
} else {
VIR_DEBUG("Security model not initialized");
}
ctrl->veths = veths; ctrl->veths = veths;
ctrl->nveths = nveths; ctrl->nveths = nveths;