[libvirt] [PATCH 1/3] virfilemock: Init symbols in canonicalize_file_name()

Michal Privoznik mprivozn at redhat.com
Mon May 6 14:34:06 UTC 2019


If a program that is using this mock calls canonicalize_file_name()
as the very first function then it will face SIGSEGV because
real_canonicalize_file_name is uninitialized.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/virfilemock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/virfilemock.c b/tests/virfilemock.c
index 89e14c5b67..106032f857 100644
--- a/tests/virfilemock.c
+++ b/tests/virfilemock.c
@@ -177,6 +177,9 @@ statfs(const char *path, struct statfs *buf)
 char *
 canonicalize_file_name(const char *path)
 {
+
+    init_syms();
+
     if (getenv("LIBVIRT_MTAB")) {
         const char *p;
         char *ret;
-- 
2.21.0




More information about the libvir-list mailing list