[PATCH 3/3] svc_socket: fix use of undefined macro HAVE_GETRPCBYNUMBER_R

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

 



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@xxxxxx>
---
 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




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux