examples: hellolibvirt: fix argc check

https://gitlab.com/libvirt/libvirt/-/issues/255

Reported-by: Jeremy Alcim
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Ján Tomko 2021-12-14 11:59:43 +01:00
parent 497e6f5fa6
commit dacf616b78

View File

@ -107,11 +107,12 @@ main(int argc, char *argv[])
{
int ret = 0;
virConnectPtr conn;
char *uri;
char *uri = NULL;
printf("Attempting to connect to hypervisor\n");
uri = (argc > 0 ? argv[1] : NULL);
if (argc > 1)
uri = argv[1];
/* virConnectOpenAuth is called here with all default parameters,
* except, possibly, the URI of the hypervisor. */