summaryrefslogtreecommitdiff
path: root/tests/virpcimock.c
diff options
context:
space:
mode:
authorRoman Bolshakov <r.bolshakov@yadro.com>2020-11-03 17:26:28 +0300
committerAndrea Bolognani <abologna@redhat.com>2020-11-04 11:53:57 +0100
commit31eb96358fdfec5ea0ee807fc1583746b1ca9a0d (patch)
treec28faa7d306a160d74f8219cceb031034d96ab66 /tests/virpcimock.c
parent457877eae48d5cf3dc1ff687a8cc69def557a570 (diff)
downloadlibvirt-31eb96358fdfec5ea0ee807fc1583746b1ca9a0d.tar.gz
virpcimock: Initialize real_close before using it
real_close() is not inialized by the first invocation of close(). That causes an issue when the mock is used before others and a call of real_close() results in a jump to NULL pointer. Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Diffstat (limited to 'tests/virpcimock.c')
-rw-r--r--tests/virpcimock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 064218d275..438cb7a672 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -1123,6 +1123,8 @@ opendir(const char *path)
int
close(int fd)
{
+ init_syms();
+
if (remove_fd(fd) < 0)
return -1;
return real_close(fd);