summaryrefslogtreecommitdiffstats
path: root/support/nfs/svc_create.c
diff options
context:
space:
mode:
authorMi Jinlong <mijinlong@cn.fujitsu.com>2011-08-03 12:52:48 -0400
committerSteve Dickson <steved@redhat.com>2011-08-03 13:41:12 -0400
commitab5977afefc805a0be172662fe03207fad8769ad (patch)
tree9d193a7f2ea42020fbd4ae9f19d052d80798af57 /support/nfs/svc_create.c
parentbdaecae8ac3ff2c4f1b643c9226699f5a8295a45 (diff)
downloadnfs-utils-ab5977afefc805a0be172662fe03207fad8769ad.tar.gz
nfs-utils-ab5977afefc805a0be172662fe03207fad8769ad.tar.xz
nfs-utils-ab5977afefc805a0be172662fe03207fad8769ad.zip
rpc.mountd: let mountd consult /etc/services for port
At RHEL, if user set port for mountd at /etc/services as "mount 12345/tcp", mountd should be bind to 12345, but the latest nfs-utils, mountd get a rand port, not 12345. This patch make sure mountd be bind to the port which was set at /etc/service. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/nfs/svc_create.c')
-rw-r--r--support/nfs/svc_create.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/support/nfs/svc_create.c b/support/nfs/svc_create.c
index b3f75ed..c159fc8 100644
--- a/support/nfs/svc_create.c
+++ b/support/nfs/svc_create.c
@@ -393,7 +393,7 @@ nfs_svc_create(char *name, const rpcprog_t program, const rpcvers_t version,
const struct sigaction create_sigaction = {
.sa_handler = SIG_IGN,
};
- unsigned int visible, up;
+ unsigned int visible, up, servport;
struct netconfig *nconf;
void *handlep;
@@ -417,8 +417,13 @@ nfs_svc_create(char *name, const rpcprog_t program, const rpcvers_t version,
if (!(nconf->nc_flag & NC_VISIBLE))
continue;
visible++;
+ if (port == 0)
+ servport = getservport(program, nconf->nc_proto);
+ else
+ servport = port;
+
up += svc_create_nconf(name, program, version, dispatch,
- port, nconf);
+ servport, nconf);
}
if (visible == 0)