[PATCH v2 1/3] virpcimock: Initialize real_close before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux