]> xenbits.xensource.com Git - libvirt.git/commitdiff
virfilemock: Init symbols in canonicalize_file_name()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 6 May 2019 14:08:34 +0000 (16:08 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 7 May 2019 07:56:17 +0000 (09:56 +0200)
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

index 89e14c5b67b44e81f2709cdf1984bcad3dfceac2..106032f857c2e2b76bac05908a3218332de18b31 100644 (file)
@@ -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;