LXC fix return code handling in lxcVmStart

In lxcVmStart we first should not reuse rc for another purpose
than the return value.

* src/lxc/lxc_driver.c: don't reuse rc for local procedure calls
This commit is contained in:
Ryota Ozaki 2009-10-13 16:36:59 +02:00 committed by Daniel Veillard
parent b8b260dde9
commit c861237a64

View File

@ -1117,7 +1117,7 @@ static int lxcVmStart(virConnectPtr conn,
lxc_driver_t * driver, lxc_driver_t * driver,
virDomainObjPtr vm) virDomainObjPtr vm)
{ {
int rc = -1; int rc = -1, r;
unsigned int i; unsigned int i;
int parentTty; int parentTty;
char *parentTtyPath = NULL; char *parentTtyPath = NULL;
@ -1126,8 +1126,8 @@ static int lxcVmStart(virConnectPtr conn,
unsigned int nveths = 0; unsigned int nveths = 0;
char **veths = NULL; char **veths = NULL;
if ((rc = virFileMakePath(driver->logDir)) < 0) { if ((r = virFileMakePath(driver->logDir)) < 0) {
virReportSystemError(conn, rc, virReportSystemError(conn, r,
_("cannot create log directory '%s'"), _("cannot create log directory '%s'"),
driver->logDir); driver->logDir);
return -1; return -1;
@ -1157,10 +1157,8 @@ static int lxcVmStart(virConnectPtr conn,
goto cleanup; goto cleanup;
/* Persist the live configuration now we have veth & tty info */ /* Persist the live configuration now we have veth & tty info */
if (virDomainSaveConfig(conn, driver->stateDir, vm->def) < 0) { if (virDomainSaveConfig(conn, driver->stateDir, vm->def) < 0)
rc = -1;
goto cleanup; goto cleanup;
}
if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT, if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT,
S_IRUSR|S_IWUSR)) < 0) { S_IRUSR|S_IWUSR)) < 0) {
@ -1183,11 +1181,10 @@ static int lxcVmStart(virConnectPtr conn,
goto cleanup; goto cleanup;
/* And get its pid */ /* And get its pid */
if ((rc = virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) != 0) { if ((r = virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) != 0) {
virReportSystemError(conn, rc, virReportSystemError(conn, r,
_("Failed to read pid file %s/%s.pid"), _("Failed to read pid file %s/%s.pid"),
driver->stateDir, vm->def->name); driver->stateDir, vm->def->name);
rc = -1;
goto cleanup; goto cleanup;
} }