[libvirt] [PATCH 4/5] libvirt_nss: Pass @name to appendAddr()

Michal Privoznik posted 5 patches 6 years, 6 months ago
[libvirt] [PATCH 4/5] libvirt_nss: Pass @name to appendAddr()
Posted by Michal Privoznik 6 years, 6 months ago
In the nss plugin we have ERROR() macro which by default does
nothing. However, at compile time it can be made to report errors
(this is useful for debugging because by nature of NSS debugging
is hard). Anyway, the appendAddr() function uses @name (which
contains name the caller wants us to resolve) for error
reporting. But the caller findLeaseInJSON() is not passing it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tools/nss/libvirt_nss.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 3b2583669b..b0e118bf37 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -80,7 +80,8 @@ typedef struct {
 
 
 static int
-appendAddr(leaseAddress **tmpAddress,
+appendAddr(const char *name ATTRIBUTE_UNUSED,
+           leaseAddress **tmpAddress,
            size_t *ntmpAddress,
            virJSONValuePtr lease,
            int af)
@@ -196,7 +197,7 @@ findLeaseInJSON(leaseAddress **tmpAddress,
         DEBUG("Found record for %s", name);
         *found = true;
 
-        if (appendAddr(tmpAddress, ntmpAddress, lease, af) < 0)
+        if (appendAddr(name, tmpAddress, ntmpAddress, lease, af) < 0)
             return -1;
     }
 
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/5] libvirt_nss: Pass @name to appendAddr()
Posted by Erik Skultety 6 years, 6 months ago
On Sat, Jul 13, 2019 at 12:58:37PM +0200, Michal Privoznik wrote:
> In the nss plugin we have ERROR() macro which by default does
> nothing. However, at compile time it can be made to report errors
> (this is useful for debugging because by nature of NSS debugging
> is hard). Anyway, the appendAddr() function uses @name (which
> contains name the caller wants us to resolve) for error
> reporting. But the caller findLeaseInJSON() is not passing it.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list