
Michal Privoznik wrote:
On 29.03.2016 12:08, Roman Bogorodskiy wrote:
Michal Privoznik wrote:
On 27.03.2016 20:07, Roman Bogorodskiy wrote:
* tools/nss/libvirt_nss.[ch]: add BSD-comptabile wrappers and register via the nss_module_register() interface * m4/virt-nss.m4: add checks if we're building NSS for FreeBSD * tools/Makefile.am: handle target library name differences, as Linux needs libnss_libvirt.so.2 and FreeBSD needs nss_libvirt.so.1. Also, different syms files have to be used as Linux needs to export all the methods while FreeBSD only needs to have nss_module_register() * tests/nsstest.c, tests/nssmock.c: s/__linux__/NSS/ * libvirt_nss_bsd.syms: FreeBSD syms file --- m4/virt-nss.m4 | 18 +++++- tests/nssmock.c | 6 +- tests/nsstest.c | 2 +- tools/Makefile.am | 16 ++++- tools/nss/libvirt_nss.c | 139 +++++++++++++++++++++++++++++++++++++++-- tools/nss/libvirt_nss.h | 9 +++ tools/nss/libvirt_nss_bsd.syms | 9 +++ 7 files changed, 189 insertions(+), 10 deletions(-) create mode 100644 tools/nss/libvirt_nss_bsd.syms index b4a4260..31b1177 100644 --- a/tests/nssmock.c +++ b/tests/nssmock.c @@ -20,7 +20,7 @@
#include <config.h>
-#ifdef __linux__ +#ifdef NSS # include <stdio.h> # include <stdlib.h> # include <dlfcn.h> @@ -107,7 +107,7 @@ open(const char *path, int flags, ...) va_list ap; mode_t mode; va_start(ap, flags); - mode = va_arg(ap, mode_t); + mode = va_arg(ap, int);
Why this change? I mean, even in the context it can be seen that @mode is type of mode_t.
Yeah, I should have mentioned that in the commit log.
I have an error like this:
In file included from ../gnulib/lib/stdio.h:51:0, from nssmock.c:24: nssmock.c: In function 'open': nssmock.c:110:27: error: 'mode_t' is promoted to 'int' when passed through '...' [-Werror] mode = va_arg(ap, mode_t); ^ nssmock.c:110:27: note: (so you should pass 'int' not 'mode_t' to 'va_arg') nssmock.c:110:27: note: if this code is reached, the program will abort cc1: all warnings being treated as errors Makefile:4854: recipe for target 'nssmock_la-nssmock.lo' failed
This is with:
gcc version 4.8.5 (FreeBSD Ports Collection)
Adjusted the commit message to reflect s/mode_t/int/ change and pushed; thanks! Roman Bogorodskiy