mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
securityselinuxlabeltest: Prefer virGetLastErrorMessage() over virGetLastError
At the beginning of the test, some preparation work is done. For instance new virSecurityManager is created. If this fails for whatever reason, we try to fetch the latest error and print the error message contained in it. However, if there's a bug in our code and no error is reported, this approach will lead to crash, while with virGetLastErrorMessage() it won't. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
84b476e2bd
commit
1758ee4a94
@ -354,9 +354,8 @@ mymain(void)
|
||||
if (!(mgr = virSecurityManagerNew("selinux", "QEMU",
|
||||
VIR_SECURITY_MANAGER_DEFAULT_CONFINED |
|
||||
VIR_SECURITY_MANAGER_PRIVILEGED))) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
VIR_TEST_VERBOSE("Unable to initialize security driver: %s\n",
|
||||
err->message);
|
||||
virGetLastErrorMessage());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user