]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
libvirtd: avoid false-positive NULL-deref warning from clang
authorEric Blake <eblake@redhat.com>
Mon, 1 Mar 2010 18:59:43 +0000 (11:59 -0700)
committerJim Meyering <meyering@redhat.com>
Tue, 2 Mar 2010 08:02:40 +0000 (09:02 +0100)
* daemon/libvirtd.c (qemudWorker): Rewrite loop to silence a
warning.

daemon/libvirtd.c

index 9bdbecb779fb477e10b84d45e9f72f04ee2e31df..b44d9b4e8f7c5344926a1fb73ee4f02a355b70be 100644 (file)
@@ -1502,16 +1502,15 @@ static void *qemudWorker(void *data)
         struct qemud_client_message *msg;
 
         virMutexLock(&server->lock);
-        while (((client = qemudPendingJob(server)) == NULL) &&
-               !worker->quitRequest) {
-            if (virCondWait(&server->job, &server->lock) < 0) {
+        while ((client = qemudPendingJob(server)) == NULL) {
+            if (worker->quitRequest ||
+                virCondWait(&server->job, &server->lock) < 0) {
                 virMutexUnlock(&server->lock);
                 return NULL;
             }
         }
         if (worker->quitRequest) {
-            if (client)
-                virMutexUnlock(&client->lock);
+            virMutexUnlock(&client->lock);
             virMutexUnlock(&server->lock);
             return NULL;
         }