[PATCH v2 1/3] virpcimock: Initialize real_close before using it
Roman Bolshakov
r.bolshakov at yadro.com
Tue Nov 3 14:26:28 UTC 2020
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 at yadro.com>
---
tests/virpcimock.c | 2 ++
1 file changed, 2 insertions(+)
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);
--
2.28.0
More information about the libvir-list
mailing list