]> xenbits.xensource.com Git - libvirt.git/commitdiff
virpcimock: Initialize real_close before using it
authorRoman Bolshakov <r.bolshakov@yadro.com>
Tue, 3 Nov 2020 14:26:28 +0000 (17:26 +0300)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 4 Nov 2020 10:53:57 +0000 (11:53 +0100)
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>
tests/virpcimock.c

index 064218d275d98ecc5042160565671f6d0789c64d..438cb7a6721935ed7d88d1acf5276b5b7b6d8185 100644 (file)
@@ -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);