[libvirt] [PATCH] tests: Put a mock library at the start of LD_PRELOAD

Jiri Denemark jdenemar at redhat.com
Tue Jul 30 09:29:11 UTC 2013


This fixes vircgrouptest when run in a sandbox which already overrides
open() and others.
---
 tests/testutils.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/testutils.h b/tests/testutils.h
index 27af5da..8583747 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -87,8 +87,9 @@ int virtTestMain(int argc,
                 perror(lib);                                            \
                 return EXIT_FAILURE;                                    \
             }                                                           \
-            if (virAsprintf(&newenv, "%s%s%s", preload ? preload : "",  \
-                            preload ? ":" : "", lib) < 0) {             \
+            if (!preload) {                                             \
+                newenv = (char *) lib;                                  \
+            } else if (virAsprintf(&newenv, "%s:%s", lib, preload) < 0) {   \
                 perror("virAsprintf");                                  \
                 return EXIT_FAILURE;                                    \
             }                                                           \
-- 
1.8.3.2




More information about the libvir-list mailing list