mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
c4d18e8b3e
g_strerror is offers the safety/correctness benefits of strerror_r, with the API design convenience of strerror. Use of virStrerror should be eliminated through the codebase in favour of g_strerror. commandhelper.c is a special case as its a tiny single threaded test program, not linked to glib, so it just uses traditional strerror(). Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
40 lines
867 B
C
40 lines
867 B
C
#include <config.h>
|
|
|
|
#include <unistd.h>
|
|
#include "security/security_driver.h"
|
|
#include "virrandom.h"
|
|
#include "testutils.h"
|
|
|
|
static int
|
|
mymain(void)
|
|
{
|
|
virSecurityManagerPtr mgr;
|
|
const char *doi, *model;
|
|
|
|
mgr = virSecurityManagerNew(NULL, "QEMU", VIR_SECURITY_MANAGER_DEFAULT_CONFINED);
|
|
if (mgr == NULL) {
|
|
fprintf(stderr, "Failed to start security driver");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
model = virSecurityManagerGetModel(mgr);
|
|
if (!model) {
|
|
fprintf(stderr, "Failed to copy secModel model: %s",
|
|
g_strerror(errno));
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
doi = virSecurityManagerGetDOI(mgr);
|
|
if (!doi) {
|
|
fprintf(stderr, "Failed to copy secModel DOI: %s",
|
|
g_strerror(errno));
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
virObjectUnref(mgr);
|
|
|
|
return 0;
|
|
}
|
|
|
|
VIR_TEST_MAIN(mymain)
|