mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
vboxDumpSharedFolders: return a value
The allocation errors in this function are already handled by jumping to a cleanup label. Change the return type from void to int and return -1 on error. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bfdc62e415
commit
c94bb0427b
@ -3627,19 +3627,23 @@ vboxDumpDisplay(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
|
vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
|
||||||
{
|
{
|
||||||
vboxArray sharedFolders = VBOX_ARRAY_INITIALIZER;
|
vboxArray sharedFolders = VBOX_ARRAY_INITIALIZER;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
def->nfss = 0;
|
def->nfss = 0;
|
||||||
|
|
||||||
gVBoxAPI.UArray.vboxArrayGet(&sharedFolders, machine,
|
gVBoxAPI.UArray.vboxArrayGet(&sharedFolders, machine,
|
||||||
gVBoxAPI.UArray.handleMachineGetSharedFolders(machine));
|
gVBoxAPI.UArray.handleMachineGetSharedFolders(machine));
|
||||||
|
|
||||||
if (sharedFolders.count <= 0)
|
if (sharedFolders.count <= 0) {
|
||||||
|
if (sharedFolders.count == 0)
|
||||||
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC_N(def->fss, sharedFolders.count) < 0)
|
if (VIR_ALLOC_N(def->fss, sharedFolders.count) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3683,8 +3687,11 @@ vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine
|
|||||||
++def->nfss;
|
++def->nfss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
gVBoxAPI.UArray.vboxArrayRelease(&sharedFolders);
|
gVBoxAPI.UArray.vboxArrayRelease(&sharedFolders);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4179,7 +4186,8 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
if (vboxDumpDisks(def, data, machine) < 0)
|
if (vboxDumpDisks(def, data, machine) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
vboxDumpSharedFolders(def, data, machine);
|
if (vboxDumpSharedFolders(def, data, machine) < 0)
|
||||||
|
goto cleanup;
|
||||||
vboxDumpNetwork(def, data, machine, networkAdapterCount);
|
vboxDumpNetwork(def, data, machine, networkAdapterCount);
|
||||||
vboxDumpAudio(def, data, machine);
|
vboxDumpAudio(def, data, machine);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user