mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Avoid closing uninitialized FDs when LXC startup fails
If an LXC domain failed to start because of a bogus SELinux label, virLXCProcessStart would call VIR_CLOSE(0) by mistake. This is because the code which initializes the member of the ttyFDs array to -1 got moved too far away from the place where the array is first allocated. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
b2878ed860
commit
2f98a7f7ba
@ -1077,6 +1077,8 @@ int virLXCProcessStart(virConnectPtr conn,
|
|||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
for (i = 0 ; i < vm->def->nconsoles ; i++)
|
||||||
|
ttyFDs[i] = -1;
|
||||||
|
|
||||||
/* If you are using a SecurityDriver with dynamic labelling,
|
/* If you are using a SecurityDriver with dynamic labelling,
|
||||||
then generate a security label for isolation */
|
then generate a security label for isolation */
|
||||||
@ -1096,9 +1098,6 @@ int virLXCProcessStart(virConnectPtr conn,
|
|||||||
vm->def, NULL) < 0)
|
vm->def, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0 ; i < vm->def->nconsoles ; i++)
|
|
||||||
ttyFDs[i] = -1;
|
|
||||||
|
|
||||||
for (i = 0 ; i < vm->def->nconsoles ; i++) {
|
for (i = 0 ; i < vm->def->nconsoles ; i++) {
|
||||||
char *ttyPath;
|
char *ttyPath;
|
||||||
if (vm->def->consoles[i]->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
if (vm->def->consoles[i]->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user