summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-03-25 19:18:43 +0000
committeralfred <alfred@FreeBSD.org>2001-03-25 19:18:43 +0000
commitf6ff30b00b102be9350141bd0aaa57669db57a87 (patch)
tree5e0ab104352f1c061c7003549925ff8adab1849a
parent6f7cfa9511abbf4898afea576821cae9c1246087 (diff)
downloadFreeBSD-src-f6ff30b00b102be9350141bd0aaa57669db57a87.zip
FreeBSD-src-f6ff30b00b102be9350141bd0aaa57669db57a87.tar.gz
fix -o port=xxx
-rw-r--r--sbin/mount_nfs/mount_nfs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c
index c1d7466..19f8fa5 100644
--- a/sbin/mount_nfs/mount_nfs.c
+++ b/sbin/mount_nfs/mount_nfs.c
@@ -172,7 +172,7 @@ int retrycnt = DEF_RETRY;
int opflags = 0;
int nfsproto = IPPROTO_UDP;
int mnttcp_ok = 1;
-u_short port_no = 0;
+char *port_no = "nfs";
enum {
ANY,
V2,
@@ -366,8 +366,11 @@ main(argc, argv)
nfsargsp->sotype = SOCK_STREAM;
nfsproto = IPPROTO_TCP;
}
- if(altflags & ALTF_PORT)
- port_no = atoi(strstr(optarg, "port=") + 5);
+ if(altflags & ALTF_PORT) {
+ port_no = strdup(strstr(optarg, "port=") + 5);
+ if (port_no == NULL)
+ err(1, NULL);
+ }
mountmode = ANY;
if(altflags & ALTF_NFSV2)
mountmode = V2;
@@ -641,7 +644,7 @@ getnfsargs(spec, nfsargsp)
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_NUMERICHOST;
hints.ai_socktype = nfsargsp->sotype;
- if (getaddrinfo(hostp, "nfs", &hints, &ai_nfs) == 0) {
+ if (getaddrinfo(hostp, port_no, &hints, &ai_nfs) == 0) {
if ((nfsargsp->flags & NFSMNT_KERB)) {
hints.ai_flags = 0;
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host,
@@ -653,7 +656,7 @@ getnfsargs(spec, nfsargsp)
}
} else {
hints.ai_flags = 0;
- if ((ecode = getaddrinfo(hostp, "nfs", &hints, &ai_nfs)) != 0) {
+ if ((ecode = getaddrinfo(hostp, port_no, &hints, &ai_nfs)) != 0) {
warnx("can't get net id for host/nfs: %s",
gai_strerror(ecode));
return (0);
OpenPOWER on IntegriCloud