mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
ch_conf: Dissolve chExtractVersionInfo() in chExtractVersion()
After previous patches, there's not much value in chExtractVersion(). Rename chExtractVersionInfo() to chExtractVersion() and have it use virCHDriver directly. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
b5fcd27a08
commit
da91bdf836
@ -191,8 +191,8 @@ virCHDriverConfigDispose(void *obj)
|
|||||||
|
|
||||||
#define MIN_VERSION ((15 * 1000000) + (0 * 1000) + (0))
|
#define MIN_VERSION ((15 * 1000000) + (0 * 1000) + (0))
|
||||||
|
|
||||||
static int
|
int
|
||||||
chExtractVersionInfo(int *retversion)
|
chExtractVersion(virCHDriver *driver)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned long version;
|
unsigned long version;
|
||||||
@ -201,8 +201,6 @@ chExtractVersionInfo(int *retversion)
|
|||||||
g_autofree char *ch_cmd = g_find_program_in_path(CH_CMD);
|
g_autofree char *ch_cmd = g_find_program_in_path(CH_CMD);
|
||||||
virCommand *cmd = virCommandNewArgList(ch_cmd, "--version", NULL);
|
virCommand *cmd = virCommandNewArgList(ch_cmd, "--version", NULL);
|
||||||
|
|
||||||
*retversion = 0;
|
|
||||||
|
|
||||||
virCommandAddEnvString(cmd, "LC_ALL=C");
|
virCommandAddEnvString(cmd, "LC_ALL=C");
|
||||||
virCommandSetOutputBuffer(cmd, &help);
|
virCommandSetOutputBuffer(cmd, &help);
|
||||||
|
|
||||||
@ -230,22 +228,10 @@ chExtractVersionInfo(int *retversion)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
*retversion = version;
|
driver->version = version;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int chExtractVersion(virCHDriver *driver)
|
|
||||||
{
|
|
||||||
if (driver->version > 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (chExtractVersionInfo(&driver->version) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user