mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: qemuxml2argvmock: Allow 'safe' file descriptors in mocked virCommandPassFD
Allow FDs which are marked as safe for FD passing. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
22d8f55b21
commit
d06a8ebe8f
@ -184,12 +184,26 @@ virNetDevRunEthernetScript(const char *ifname ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned int flags);
|
||||||
|
|
||||||
|
static const int testCommandPassSafeFDs[] = { -1 };
|
||||||
|
|
||||||
void
|
void
|
||||||
virCommandPassFD(virCommandPtr cmd ATTRIBUTE_UNUSED,
|
virCommandPassFD(virCommandPtr cmd,
|
||||||
int fd ATTRIBUTE_UNUSED,
|
int fd,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
/* nada */
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_CARDINALITY(testCommandPassSafeFDs); i++) {
|
||||||
|
if (testCommandPassSafeFDs[i] == fd) {
|
||||||
|
if (!real_virCommandPassFD)
|
||||||
|
VIR_MOCK_REAL_INIT(virCommandPassFD);
|
||||||
|
|
||||||
|
real_virCommandPassFD(cmd, fd, flags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user