mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
tools: remove unneeded cleanup labels
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c0666eb7c8
commit
10d6290f1c
@ -74,21 +74,17 @@ virshNetworkEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
size_t i = 0;
|
||||
char **ret = NULL;
|
||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < VIR_NETWORK_EVENT_ID_LAST; i++)
|
||||
tmp[i] = g_strdup(virshNetworkEventCallbacks[i].name);
|
||||
|
||||
ret = g_steal_pointer(&tmp);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return g_steal_pointer(&tmp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2571,7 +2571,6 @@ virshBlockJobInfo(vshControl *ctl,
|
||||
virshControlPtr priv = ctl->privData;
|
||||
unsigned long long speed;
|
||||
unsigned int flags = 0;
|
||||
bool ret = false;
|
||||
int rc = -1;
|
||||
|
||||
/* If bytes were requested, or if raw mode is not forcing a MiB/s
|
||||
@ -2593,7 +2592,7 @@ virshBlockJobInfo(vshControl *ctl,
|
||||
}
|
||||
G_GNUC_FALLTHROUGH;
|
||||
default:
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
speed = info.bandwidth;
|
||||
@ -2602,7 +2601,7 @@ virshBlockJobInfo(vshControl *ctl,
|
||||
if (rc < 0) {
|
||||
flags &= ~VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES;
|
||||
if ((rc = virDomainGetBlockJobInfo(dom, path, &info, flags)) < 0)
|
||||
goto cleanup;
|
||||
return false;
|
||||
speed = info.bandwidth;
|
||||
/* Scale to bytes/s unless in raw mode */
|
||||
if (!raw) {
|
||||
@ -2610,7 +2609,7 @@ virshBlockJobInfo(vshControl *ctl,
|
||||
if (speed >> 20 != info.bandwidth) {
|
||||
vshError(ctl, _("overflow in converting %ld MiB/s to bytes\n"),
|
||||
info.bandwidth);
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2618,8 +2617,7 @@ virshBlockJobInfo(vshControl *ctl,
|
||||
if (rc == 0) {
|
||||
if (!raw)
|
||||
vshPrintExtra(ctl, _("No current block job for %s"), path);
|
||||
ret = true;
|
||||
goto cleanup;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (raw) {
|
||||
@ -2638,10 +2636,7 @@ virshBlockJobInfo(vshControl *ctl,
|
||||
vshPrint(ctl, "\n");
|
||||
}
|
||||
|
||||
ret = true;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -2982,34 +2977,31 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom,
|
||||
const char *name,
|
||||
unsigned int flags)
|
||||
{
|
||||
bool ret = false;
|
||||
int state;
|
||||
virshControlPtr priv = ctl->privData;
|
||||
|
||||
if ((state = virshDomainState(ctl, dom, NULL)) < 0) {
|
||||
vshError(ctl, "%s", _("Unable to get domain status"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state == VIR_DOMAIN_SHUTOFF) {
|
||||
vshError(ctl, "%s", _("The domain is not running"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
vshError(ctl, "%s", _("Cannot run interactive console without a controlling TTY"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
vshPrintExtra(ctl, _("Connected to domain %s\n"), virDomainGetName(dom));
|
||||
vshPrintExtra(ctl, _("Escape character is %s\n"), priv->escapeChar);
|
||||
fflush(stdout);
|
||||
if (virshRunConsole(ctl, dom, name, flags) == 0)
|
||||
ret = true;
|
||||
return true;
|
||||
|
||||
cleanup:
|
||||
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -5044,7 +5036,7 @@ cmdSchedInfoUpdateOne(vshControl *ctl,
|
||||
field, param->type,
|
||||
value) < 0) {
|
||||
vshSaveLibvirtError();
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
@ -5053,7 +5045,6 @@ cmdSchedInfoUpdateOne(vshControl *ctl,
|
||||
if (ret < 0)
|
||||
vshError(ctl, _("invalid scheduler option: %s"), field);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -9708,26 +9699,22 @@ static bool
|
||||
cmdQemuAttach(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
bool ret = false;
|
||||
unsigned int flags = 0;
|
||||
unsigned int pid_value; /* API uses unsigned int, not pid_t */
|
||||
virshControlPtr priv = ctl->privData;
|
||||
|
||||
if (vshCommandOptUInt(ctl, cmd, "pid", &pid_value) <= 0)
|
||||
goto cleanup;
|
||||
return false;
|
||||
|
||||
if (!(dom = virDomainQemuAttach(priv->conn, pid_value, flags))) {
|
||||
vshError(ctl, _("Failed to attach to pid %u"), pid_value);
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
vshPrintExtra(ctl, _("Domain %s attached to pid %u\n"),
|
||||
virDomainGetName(dom), pid_value);
|
||||
virshDomainFree(dom);
|
||||
ret = true;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2514,7 +2514,6 @@ vshTreePrintInternal(vshControl *ctl,
|
||||
{
|
||||
size_t i;
|
||||
int nextlastdev = -1;
|
||||
int ret = -1;
|
||||
const char *dev = (lookup)(devid, false, opaque);
|
||||
|
||||
/* Print this device, with indent if not at root */
|
||||
@ -2548,7 +2547,7 @@ vshTreePrintInternal(vshControl *ctl,
|
||||
vshTreePrintInternal(ctl, lookup, opaque,
|
||||
num_devices, i, nextlastdev,
|
||||
false, indent) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
virBufferTrim(indent, " ", -1);
|
||||
|
||||
@ -2559,9 +2558,8 @@ vshTreePrintInternal(vshControl *ctl,
|
||||
|
||||
if (!root)
|
||||
virBufferTrim(indent, NULL, 2);
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user