mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
bhyve: refactor bhyveProbeCapsFromHelp
Use g_auto and remove the 'ret' variable, as well as the out label. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c5316be7a1
commit
681df4776b
@ -218,17 +218,15 @@ bhyveProbeCapsDeviceHelper(unsigned int *caps,
|
|||||||
static int
|
static int
|
||||||
bhyveProbeCapsFromHelp(unsigned int *caps, char *binary)
|
bhyveProbeCapsFromHelp(unsigned int *caps, char *binary)
|
||||||
{
|
{
|
||||||
char *help;
|
g_autofree char *help = NULL;
|
||||||
virCommand *cmd = NULL;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
int ret = 0, exit;
|
int exit;
|
||||||
|
|
||||||
cmd = virCommandNew(binary);
|
cmd = virCommandNew(binary);
|
||||||
virCommandAddArg(cmd, "-h");
|
virCommandAddArg(cmd, "-h");
|
||||||
virCommandSetErrorBuffer(cmd, &help);
|
virCommandSetErrorBuffer(cmd, &help);
|
||||||
if (virCommandRun(cmd, &exit) < 0) {
|
if (virCommandRun(cmd, &exit) < 0)
|
||||||
ret = -1;
|
return -1;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strstr(help, "-u:") != NULL)
|
if (strstr(help, "-u:") != NULL)
|
||||||
*caps |= BHYVE_CAP_RTC_UTC;
|
*caps |= BHYVE_CAP_RTC_UTC;
|
||||||
@ -239,10 +237,7 @@ bhyveProbeCapsFromHelp(unsigned int *caps, char *binary)
|
|||||||
if (strstr(help, "-c vcpus") == NULL)
|
if (strstr(help, "-c vcpus") == NULL)
|
||||||
*caps |= BHYVE_CAP_CPUTOPOLOGY;
|
*caps |= BHYVE_CAP_CPUTOPOLOGY;
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
VIR_FREE(help);
|
|
||||||
virCommandFree(cmd);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user