[libvirt] How to suppress error printing to stderr from virConnectOpen*?

Richard W.M. Jones rjones at redhat.com
Fri May 6 16:43:41 UTC 2011


I can set the global error handling function (virSetErrorFunc).  That
doesn't seem to be a good idea from a library.  Looking at the code,
it doesn't appear that the internal virErrorHandler is thread-local,
so I can't set it and restore it around the function call.

I can set the error handling function _after_ I've got a connection
object (virConnSetErrorFunc).  That doesn't help with making the
initial connection.

libguestfs itself has the same problem with the guestfs_create call,
so I'm not going to point any fingers :-)  However it seems like a
shortcoming of the libvirt API.

Am I missing something here?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the libvir-list mailing list