]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix duplicating logging of errors in libvirtd
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 19 Oct 2009 17:28:28 +0000 (18:28 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 2 Nov 2009 16:22:02 +0000 (11:22 -0500)
The libvirt default error handling callback will print all errors
to stderr. The libvirtd default logging callback will do the same.
Set a no-op error handling callback in libvirtd to prevent this
duplication

* daemon/libvirtd.c: Register a no-op error handling function

daemon/libvirtd.c

index c5f90b5266dacf0ffe9b2542237e789676a5c387..0c9701068403d97f207b9d11110ebf46798e28e9 100644 (file)
@@ -776,6 +776,12 @@ static int qemudInitPaths(struct qemud_server *server,
     return ret;
 }
 
+static void virshErrorHandler(void *opaque ATTRIBUTE_UNUSED, virErrorPtr err ATTRIBUTE_UNUSED)
+{
+    /* Don't do anything, since logging infrastructure already
+     * took care of reporting the error */
+}
+
 static struct qemud_server *qemudInitialize(int sigread) {
     struct qemud_server *server;
 
@@ -2995,6 +3001,9 @@ int main(int argc, char **argv) {
     if (remoteReadConfigFile (server, remote_config_file) < 0)
         goto error2;
 
+    /* Disable error func, now logging is setup */
+    virSetErrorFunc(NULL, virshErrorHandler);
+
     if (virEventAddHandleImpl(sigpipe[0],
                               VIR_EVENT_HANDLE_READABLE,
                               qemudDispatchSignalEvent,