mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-12 00:16:05 -06:00
* tests/reconnect.c: fixed the reconnect test when running as non-root
Daniel
This commit is contained in:
parent
a10b68be0a
commit
4fc5f43399
@ -1,3 +1,7 @@
|
||||
Thu Nov 9 10:22:43 CET 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* tests/reconnect.c: fixed the reconnect test when running as non-root
|
||||
|
||||
Wed Nov 8 13:03:41 EDT 2006 Daniel Berrange <berrange@redhat.com>
|
||||
|
||||
* src/virshdata/nodeinfo-custom.txt, docs/testnode.xml: Reduce amount
|
||||
|
@ -1,13 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
static void errorHandler(void *userData, virErrorPtr error) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int id = 0;
|
||||
int ro = 0;
|
||||
virConnectPtr conn;
|
||||
virDomainPtr dom;
|
||||
|
||||
conn = virConnectOpen("");
|
||||
virSetErrorFunc(NULL, errorHandler);
|
||||
|
||||
conn = virConnectOpen(NULL);
|
||||
if (conn == NULL) {
|
||||
ro = 1;
|
||||
conn = virConnectOpenReadOnly(NULL);
|
||||
}
|
||||
if (conn == NULL) {
|
||||
fprintf(stderr, "First virConnectOpen() failed\n");
|
||||
exit(1);
|
||||
@ -19,7 +30,10 @@ int main(void) {
|
||||
}
|
||||
virDomainFree(dom);
|
||||
virConnectClose(conn);
|
||||
conn = virConnectOpen("");
|
||||
if (ro == 1)
|
||||
conn = virConnectOpenReadOnly(NULL);
|
||||
else
|
||||
conn = virConnectOpen(NULL);
|
||||
if (conn == NULL) {
|
||||
fprintf(stderr, "Second virConnectOpen() failed\n");
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user