Linux-NFS Archive on lore.kernel.org
 help / Atom feed
* [PATCH 1/3] configure.ac: more carefully detect availability of res_querydomain(3)
@ 2019-02-04 14:31 Patrick Steinhardt
  2019-02-04 14:31 ` [PATCH 2/3] file: fix missing include for PATH_MAX constant Patrick Steinhardt
  2019-02-04 14:31 ` [PATCH 3/3] svc_socket: fix use of undefined macro HAVE_GETRPCBYNUMBER_R Patrick Steinhardt
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick Steinhardt @ 2019-02-04 14:31 UTC (permalink / raw)
  To: linux-nfs; +Cc: Patrick Steinhardt

Since glibc 2.2, the function res_querydomain(3) is implemented as a
define to `__res_querydomain`. Due to this implementation detail, using
`AC_CHECK_LIB` with a symbol name of "res_querydomain" will cause a
linking failure and thus fail to detect its availability. This is why
right now, we try to detect availability of `__res_querydomain` instead.

Unfortunately, this may break on other platforms where there is no
`__res_querydomain` but only the function without leading underscores.
To fix this, we can perform another `AC_CHECK_LIB([resolv],
[res_querydomain], ...)` call in case where the other one was not found
and only raise an error if both symbols weren't found.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 configure.ac | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 4bf5aea..cb9d921 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,7 +411,8 @@ if test "$enable_gss" = yes; then
 fi
 
 dnl libdnsidmap specific checks
-AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed))
+AC_CHECK_LIB([resolv], [__res_querydomain], ,
+	AC_CHECK_LIB([resolv], [res_querydomain], , AC_MSG_ERROR(res_querydomain needed)))
 
 AC_ARG_ENABLE([ldap],
 	[AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])])
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] file: fix missing include for PATH_MAX constant
  2019-02-04 14:31 [PATCH 1/3] configure.ac: more carefully detect availability of res_querydomain(3) Patrick Steinhardt
@ 2019-02-04 14:31 ` Patrick Steinhardt
  2019-02-04 14:31 ` [PATCH 3/3] svc_socket: fix use of undefined macro HAVE_GETRPCBYNUMBER_R Patrick Steinhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Patrick Steinhardt @ 2019-02-04 14:31 UTC (permalink / raw)
  To: linux-nfs; +Cc: Patrick Steinhardt

While making use of the PATH_MAX constant, "file.c" does not include the
"limits.h" header. While it is being transitively included via other
headers on most platforms, it is not on e.g. musl-based systems.

Add the include to fix compilation.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 support/misc/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/support/misc/file.c b/support/misc/file.c
index 4065376..e7c3819 100644
--- a/support/misc/file.c
+++ b/support/misc/file.c
@@ -27,6 +27,7 @@
 #include <dirent.h>
 #include <stdlib.h>
 #include <stdbool.h>
+#include <limits.h>
 
 #include "xlog.h"
 #include "misc.h"
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] svc_socket: fix use of undefined macro HAVE_GETRPCBYNUMBER_R
  2019-02-04 14:31 [PATCH 1/3] configure.ac: more carefully detect availability of res_querydomain(3) Patrick Steinhardt
  2019-02-04 14:31 ` [PATCH 2/3] file: fix missing include for PATH_MAX constant Patrick Steinhardt
@ 2019-02-04 14:31 ` Patrick Steinhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Patrick Steinhardt @ 2019-02-04 14:31 UTC (permalink / raw)
  To: linux-nfs; +Cc: Patrick Steinhardt

The macro HAVE_GETRPCBYNUMBER_R is set based on whether the
`getrpcbynumber_r` function was found by autoconf or not. While another
location correctly checks whether it is set by using `#ifdef`,
`getservport()` instead wrongly uses `#if HAVE_GETRPCBYNUMBER_R`. This
may cause a compilation error with gcc with "-Werror=undef" if the macro
has not been defined.

Fix the error by using `#ifdef` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 support/nfs/svc_socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c
index 1239712..d56507a 100644
--- a/support/nfs/svc_socket.c
+++ b/support/nfs/svc_socket.c
@@ -46,7 +46,7 @@ int getservport(u_long number, const char *proto)
 	struct rpcent *rpcp;
 	struct servent servbuf, *servp = NULL;
 	int ret = 0;
-#if HAVE_GETRPCBYNUMBER_R
+#ifdef HAVE_GETRPCBYNUMBER_R
 	char rpcdata[1024];
 	struct rpcent rpcbuf;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 14:31 [PATCH 1/3] configure.ac: more carefully detect availability of res_querydomain(3) Patrick Steinhardt
2019-02-04 14:31 ` [PATCH 2/3] file: fix missing include for PATH_MAX constant Patrick Steinhardt
2019-02-04 14:31 ` [PATCH 3/3] svc_socket: fix use of undefined macro HAVE_GETRPCBYNUMBER_R Patrick Steinhardt

Linux-NFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nfs/0 linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ https://lore.kernel.org/linux-nfs \
		linux-nfs@vger.kernel.org linux-nfs@archiver.kernel.org
	public-inbox-index linux-nfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-nfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox