summaryrefslogtreecommitdiffstats
path: root/utils/statd/sm-notify.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-12-13 14:36:15 -0500
committerSteve Dickson <steved@redhat.com>2010-12-13 14:56:11 -0500
commit7869a76207d3f4b3bd4ab57b4a7a8807ac2ff0c6 (patch)
tree9bd5c01ab84549fbb2b0d0730deca43649cc0234 /utils/statd/sm-notify.c
parente8dbaddc8465dcd07b53f8e80a537703dd0248ca (diff)
downloadnfs-utils-7869a76207d3f4b3bd4ab57b4a7a8807ac2ff0c6.tar.gz
nfs-utils-7869a76207d3f4b3bd4ab57b4a7a8807ac2ff0c6.tar.xz
nfs-utils-7869a76207d3f4b3bd4ab57b4a7a8807ac2ff0c6.zip
sm-notify: Make use of AI_NUMERICSERV conditional
Gabor Papp reports nfs-utils-1.2.3 doesn't build on his system that uses glibc-2.2.5: make[3]: Entering directory `/home/gzp/src/nfs-utils-1.2.3/utils/statd' gcc -DHAVE_CONFIG_H -I. -I../../support/include -D_GNU_SOURCE -Wall -Wextra -Wstrict-prototypes -pipe -g -O2 -MT sm-notify.o -MD -MP -MF .deps/sm-notify.Tpo -c -o sm-notify.o sm-notify.c sm-notify.c: In function 'smn_bind_address': sm-notify.c:247: error: 'AI_NUMERICSERV' undeclared (first use in this function) sm-notify.c:247: error: (Each undeclared identifier is reported only once sm-notify.c:247: error: for each function it appears in.) make[3]: *** [sm-notify.o] Error 1 According to the getaddrinfo(3) man page, AI_NUMERICSERV is available only since glibc 2.3.4. getaddrinfo(3) seems to convert strings containing a number to the right port value without the use of AI_NUMERICSERV, so I think we can survive on older glibc's without it. It will allow admins to specify service names as well as port numbers on those versions. There are uses of AI_NUMERICSERV in gssd and in nfs_svc_create(). The one in nfs_svc_create() is behind HAVE_LIBTIRPC, and the other is a issue only for those who want to deploy Kerberos -- likely in both cases, a more modern glibc will be present. I'm going to leave those two. Fix for: https://bugzilla.linux-nfs.org/show_bug.cgi?id=195 Reported-by: "Gabor Z. Papp" <gzp@papp.hu> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/statd/sm-notify.c')
-rw-r--r--utils/statd/sm-notify.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index b7f4371..1f490b0 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -34,6 +34,11 @@
#include "nsm.h"
#include "nfsrpc.h"
+/* glibc before 2.3.4 */
+#ifndef AI_NUMERICSERV
+#define AI_NUMERICSERV 0
+#endif
+
#define NSM_TIMEOUT 2
#define NSM_MAX_TIMEOUT 120 /* don't make this too big */
@@ -248,6 +253,7 @@ smn_bind_address(const char *srcaddr, const char *srcport)
if (srcaddr == NULL)
hint.ai_flags |= AI_PASSIVE;
+ /* Do not allow "node" and "service" parameters both to be NULL */
if (srcport == NULL)
error = getaddrinfo(srcaddr, "", &hint, &ai);
else