if (fp == NULL)
goto error;
temp_fd = open(temp_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
- if (temp_fd == -1) {
+ if (temp_fd == -1)
goto error;
- }
while (1) {
if (getline(&line, &line_size, fp) <= 0)
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
goto cleanup;
- }
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
}
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
goto cleanup;
- }
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
}
openvzSetProgramSentinal(progstart, vm->def->name);
- if (virRun(progstart, NULL) < 0) {
+ if (virRun(progstart, NULL) < 0)
goto cleanup;
- }
vm->pid = strtoI(vm->def->name);
vm->def->id = vm->pid;
}
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
goto cleanup;
- }
vm->pid = strtoI(vm->def->name);
vm->def->id = vm->pid;
goto cleanup;
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
goto cleanup;
- }
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
}
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
goto cleanup;
- }
ret = 0;
cleanup:
str_vcpus[31] = '\0';
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
return -1;
- }
vm->def->maxvcpus = vm->def->vcpus = nvcpus;
return 0;
snprintf(str_mem, sizeof(str_mem), "%llu", mem * 1024);
openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(prog, NULL) < 0) {
+ if (virRun(prog, NULL) < 0)
goto cleanup;
- }
return 0;
return -1;
}
- if (openvzSetDiskQuota(vmdef, fs, persist) < 0) {
+ if (openvzSetDiskQuota(vmdef, fs, persist) < 0)
return -1;
- }
cur->space_hard_limit = fs->space_hard_limit;
cur->space_soft_limit = fs->space_soft_limit;
} else {
}
}
- if (channel == NULL) {
+ if (channel == NULL)
goto err;
- }
while ((rc = libssh2_channel_exec(channel, cmd)) ==
LIBSSH2_ERROR_EAGAIN) {
}
}
- if (rc != 0) {
+ if (rc != 0)
goto err;
- }
for (;;) {
/* loop until we block */
}
}
- if (rc == 0) {
+ if (rc == 0)
exitcode = libssh2_channel_get_exit_status(channel);
- }
(*exit_status) = exitcode;
libssh2_channel_free(channel);
do {
amount = sizeof(buffer);
- if ((fileinfo.st_size - got) < amount) {
+ if ((fileinfo.st_size - got) < amount)
amount = fileinfo.st_size - got;
- }
rc = libssh2_channel_read(channel, buffer, amount);
if (rc > 0) {
cleanup:
if (ret < 0 && table_created) {
- for (i = 0; i < uuid_table->nlpars; i++) {
+ for (i = 0; i < uuid_table->nlpars; i++)
VIR_FREE(uuid_table->lpars[i]);
- }
VIR_FREE(uuid_table->lpars);
}
VIR_FREE(ids);
domain_name = escape_specialcharacters(domain->name);
- if (domain_name == NULL) {
+ if (domain_name == NULL)
goto cleanup;
- }
if (VIR_STRDUP(def->os.type, "aix") < 0)
goto cleanup;
dev = virDomainDeviceDefParse(xml, def, phyp_driver->caps, NULL,
VIR_DOMAIN_XML_INACTIVE);
- if (!dev) {
+ if (!dev)
goto cleanup;
- }
if (!
(vios_name =
sasl_callback_t *cbs;
size_t i;
int n;
- if (VIR_ALLOC_N(cbs, ncredtype+1) < 0) {
+ if (VIR_ALLOC_N(cbs, ncredtype+1) < 0)
return NULL;
- }
for (i = 0, n = 0; i < ncredtype; i++) {
int id = remoteAuthCredVir2SASL(credtype[i]);
virNetClientCallPtr call)
{
virNetClientCallPtr tmp = *head;
- while (tmp && tmp->next) {
+ while (tmp && tmp->next)
tmp = tmp->next;
- }
if (tmp)
tmp->next = call;
else
{
virNetClientCallPtr tmp = head;
while (tmp) {
- if (pred(tmp, opaque)) {
+ if (pred(tmp, opaque))
return true;
- }
tmp = tmp->next;
}
return false;
/* If we have existing SASL decoded data, pretend
* the socket became readable so we consume it
*/
- if (virNetSocketHasCachedData(client->sock)) {
+ if (virNetSocketHasCachedData(client->sock))
fds[0].revents |= POLLIN;
- }
/* If wantClose flag is set, pretend there was an error on the socket
*/
virObjectLock(srv);
- for (i = 0; i < srv->nservices; i++) {
+ for (i = 0; i < srv->nservices; i++)
virNetServerServiceClose(srv->services[i]);
- }
virObjectUnlock(srv);
}
_("Missing privateData field in JSON state document"));
goto error;
}
- if (!(client->privateData = privNew(client, child, privOpaque))) {
+ if (!(client->privateData = privNew(client, child, privOpaque)))
goto error;
- }
client->privateDataFreeFunc = privFree;
client->privateDataPreExecRestart = privPreExecRestart;
}
if (!svc)
return;
- for (i = 0; i < svc->nsocks; i++) {
+ for (i = 0; i < svc->nsocks; i++)
virNetSocketClose(svc->socks[i]);
- }
}
{
virSecurityManagerPtr* list = NULL;
- if (STREQ("stack", mgr->drv->name)) {
+ if (STREQ("stack", mgr->drv->name))
return virSecurityStackGetNested(mgr);
- }
if (VIR_ALLOC_N(list, 2) < 0)
return NULL;
/* clear the environment */
environ = NULL;
- if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0) {
+ if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0)
vah_error(ctl, 1, _("could not set PATH"));
- }
/* ensure the traditional IFS setting */
- if (setenv("IFS", " \t\n", 1) != 0) {
+ if (setenv("IFS", " \t\n", 1) != 0)
vah_error(ctl, 1, _("could not set IFS"));
- }
if (!(progname = strrchr(argv[0], '/')))
progname = argv[0];
} else if (ctl->cmd == 'c' || ctl->cmd == 'r') {
char *included_files = NULL;
- if (ctl->cmd == 'c' && virFileExists(profile)) {
+ if (ctl->cmd == 'c' && virFileExists(profile))
vah_error(ctl, 1, _("profile exists"));
- }
if (ctl->append && ctl->newfile) {
if (vah_add_file(&buf, ctl->newfile, "rw") != 0)
case VIR_DOMAIN_NET_TYPE_ETHERNET:
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit(&buf, "tuntap,");
- if (def->ifname) {
+ if (def->ifname)
virBufferAdd(&buf, def->ifname, -1);
- }
if (def->data.ethernet.ipaddr) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet interface"));
}
bridge = virNetworkGetBridgeName(network);
virNetworkFree(network);
- if (bridge == NULL) {
+ if (bridge == NULL)
goto error;
- }
if (umlConnectTapDevice(conn, vm, def, bridge) < 0) {
VIR_FREE(bridge);
dom = virDomainObjListFindByName(driver->domains, name);
- if (!dom) {
+ if (!dom)
continue;
- }
if (e.mask & IN_DELETE) {
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
FILE *pidinfo;
unsigned long long usertime, systime;
- if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0) {
+ if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0)
return -1;
- }
if (!(pidinfo = fopen(proc, "r"))) {
/* VM probably shut down, so fake 0 */
char *reply;
for (i = 0; i < vm->def->ndisks; i++) {
- if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst)) {
+ if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst))
break;
- }
}
if (i == vm->def->ndisks) {