[3/3] svc_socket: fix use of undefined macro HAVE_GETRPCBYNUMBER_R
diff mbox series

Message ID 5e9826aa52e17d30d7cfee0d3828c5dbecdbfc41.1549290423.git.ps@pks.im
State New
Headers show
Series
  • [1/3] configure.ac: more carefully detect availability of res_querydomain(3)
Related show

Commit Message

Patrick Steinhardt Feb. 4, 2019, 2:31 p.m. UTC
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(-)

Comments

Steve Dickson Feb. 27, 2019, 5:16 p.m. UTC | #1
On 2/4/19 9:31 AM, Patrick Steinhardt wrote:
> 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>
Committed...

BTW... If the future, feel free to ping me it appears 
patches slide off my radar... like these did... ;-( 

steved.
> ---
>  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;
>  
>
Patrick Steinhardt Feb. 27, 2019, 5:37 p.m. UTC | #2
On Wed, Feb 27, 2019 at 12:16:18PM -0500, Steve Dickson wrote:
> 
> 
> On 2/4/19 9:31 AM, Patrick Steinhardt wrote:
> > 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>
> Committed...
> 
> BTW... If the future, feel free to ping me it appears 
> patches slide off my radar... like these did... ;-( 
> 
> steved.

Will do. I know from my own experience that it's hard to keep
track and be able to always respond in time :)

So thanks for your review and for committing them.

Patrick

Patch
diff mbox series

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;