diff --git a/tests/seclabeltest.c b/tests/seclabeltest.c index 5d877890af6323b93be9685ed8b96168bf7a9a20..517b76cd7ca14fa234fea4dff29eb62916f9a17a 100644 --- a/tests/seclabeltest.c +++ b/tests/seclabeltest.c @@ -6,6 +6,7 @@ #include #include #include "security/security_driver.h" +#include "util.h" int main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) @@ -13,10 +14,14 @@ main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) virSecurityManagerPtr mgr; const char *doi, *model; + if (virThreadInitialize() < 0 || + virRandomInitialize(time(NULL) ^ getpid())) + exit(EXIT_FAILURE); + mgr = virSecurityManagerNew(NULL, false); if (mgr == NULL) { fprintf (stderr, "Failed to start security driver"); - exit (-1); + exit(EXIT_FAILURE); } model = virSecurityManagerGetModel(mgr); @@ -24,7 +29,7 @@ main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { fprintf (stderr, "Failed to copy secModel model: %s", strerror (errno)); - exit (-1); + exit(EXIT_FAILURE); } doi = virSecurityManagerGetDOI(mgr); @@ -32,7 +37,7 @@ main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { fprintf (stderr, "Failed to copy secModel DOI: %s", strerror (errno)); - exit (-1); + exit(EXIT_FAILURE); } virSecurityManagerFree(mgr);