[libvirt] [PATCH] nss: fix build on freebsd

Daniel P. Berrangé posted 1 patch 1 week ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190808141700.8840-1-berrange@redhat.com
tools/nss/libvirt_nss.c | 12 ++++++++----
tools/nss/libvirt_nss.h |  2 ++
2 files changed, 10 insertions(+), 4 deletions(-)

[libvirt] [PATCH] nss: fix build on freebsd

Posted by Daniel P. Berrangé 1 week ago
The conversion to drop gnulib in the previous patch:

  commit 8242ce4f45700f326e13e5105accd08fb4b2f0b4
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Thu Aug 8 10:23:26 2019 +0100

    tools: avoid accidentally using files from gnulib

Missed a few conversions needed for FreeBSD. In particular
netdb.h doesn't pull in sys/socket.h or netinet/in.h

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

Pushed as a CI fix

 tools/nss/libvirt_nss.c | 12 ++++++++----
 tools/nss/libvirt_nss.h |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index b75f51c560..89f1f3fdac 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -26,7 +26,6 @@
 
 #include "libvirt_nss.h"
 
-#include <netinet/in.h>
 #include <resolv.h>
 #include <sys/types.h>
 #include <dirent.h>
@@ -541,7 +540,9 @@ aiforaf(const char *name, int af, struct addrinfo *pai, struct addrinfo **aip)
 }
 
 int
-_nss_compat_getaddrinfo(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list ap)
+_nss_compat_getaddrinfo(void *retval,
+                        void *mdata __attribute__((unused)),
+                        va_list ap)
 {
     struct addrinfo sentinel, *cur, *ai;
     const char *name;
@@ -567,7 +568,9 @@ _nss_compat_getaddrinfo(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list ap)
 }
 
 int
-_nss_compat_gethostbyname2_r(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list ap)
+_nss_compat_gethostbyname2_r(void *retval,
+                             void *mdata __attribute__((unused)),
+                             va_list ap)
 {
     int ret;
 
@@ -594,7 +597,8 @@ _nss_compat_gethostbyname2_r(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list
 }
 
 ns_mtab*
-nss_module_register(const char *name ATTRIBUTE_UNUSED, unsigned int *size,
+nss_module_register(const char *name __attribute__((unused)),
+                    unsigned int *size,
                     nss_module_unregister_fn *unregister)
 {
     *size = sizeof(methods) / sizeof(methods[0]);
diff --git a/tools/nss/libvirt_nss.h b/tools/nss/libvirt_nss.h
index fa4ff892c6..63e1bf0af5 100644
--- a/tools/nss/libvirt_nss.h
+++ b/tools/nss/libvirt_nss.h
@@ -26,6 +26,8 @@
 #pragma once
 
 #include <nss.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 #include <netdb.h>
 
 
-- 
2.21.0

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