]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
tests: Put a mock library at the start of LD_PRELOAD
authorJiri Denemark <jdenemar@redhat.com>
Tue, 30 Jul 2013 08:41:50 +0000 (10:41 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 30 Jul 2013 15:05:43 +0000 (17:05 +0200)
This fixes vircgrouptest when run in a sandbox which already overrides
open() and others.

tests/testutils.h

index 27af5da69c26a2b524ab4bf814952327db79ca48..8583747bfa749663629ef6f60404f171c221d780 100644 (file)
@@ -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;                                    \
             }                                                           \