[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]