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

Michal Privoznik posted 3 patches 6 years, 9 months ago
[libvirt] [PATCH 1/3] virfilemock: Init symbols in canonicalize_file_name()
Posted by Michal Privoznik 6 years, 9 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] virfilemock: Init symbols in canonicalize_file_name()
Posted by Martin Kletzander 6 years, 9 months ago
ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list