[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] Re: Can't connect to lxc driver



Thanks!  Removing the if == NULL goto fail works.  Patch is attached.

Daniel P. Berrange wrote:
> On Wed, Apr 30, 2008 at 05:22:22PM -0700, Dave Leskovec wrote:
>> Hi Dan,
>>
>> I updated today to the latest CVS and can no longer connect to the lxc driver.
>> I've tracked it down to this check in doRemoteOpen() in remote_internal.c:
>>
>>     if ((
>> #ifdef HAVE_XMLURI_QUERY_RAW
>>          uri->query_raw =
>> #else
>>          uri->query =
>> #endif
>>          qparam_get_query (vars)) == NULL) goto failed;
>>
>> Looking at the recent VirBuffer changes, it looks like they changed the behavior
>> of qparam_get_query.  With the old VirBuffer, qparam_get_query returned a
>> non-NULL result because virBufferNew allocated space.  The new VirBuffer doesn't
>> allocate space until something is added and hence this function returns NULL if
>> nothing is ever put in the buffer.  I'm not familiar enough with the intended
>> behavior to know what the fix should be here.
> 
> So two things - with the old code it was impossible for qparam_get_query
> to return NULL, so the NULL check was redundant. Aside from that, it
> looks like it is valid for uri->query to be set to NULL anway to indicate
> that no variables are set. So I'd suggest you try just removing the
> NULL check & goto failed. If that doesn't work, then modify get_query
> to return "", if the buffer is NULL.
> 
> Regards,
> Dan.

-- 
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
---
 src/remote_internal.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Index: b/src/remote_internal.c
===================================================================
--- a/src/remote_internal.c	2008-04-30 17:37:14.000000000 -0700
+++ b/src/remote_internal.c	2008-04-30 22:53:13.000000000 -0700
@@ -439,13 +439,12 @@
     xmlFree (uri->query);
 #endif
 
-    if ((
 #ifdef HAVE_XMLURI_QUERY_RAW
-         uri->query_raw =
+    uri->query_raw =
 #else
-         uri->query =
+    uri->query =
 #endif
-         qparam_get_query (vars)) == NULL) goto failed;
+         qparam_get_query (vars);
 
     free_qparam_set (vars);
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]