aboutsummaryrefslogtreecommitdiff
path: root/sbin/mount_nfs
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>2001-03-25 19:18:43 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>2001-03-25 19:18:43 +0000
commit12d6e650c670541f49a9140120b8777d07123c8f (patch)
treebf0bd9cec94fde2a1c3a6a1c059dc200b1d8dced /sbin/mount_nfs
parent35910bd13ed9565de02463432d83e4cd7b60a634 (diff)
downloadsrc-12d6e650c670541f49a9140120b8777d07123c8f.tar.gz
src-12d6e650c670541f49a9140120b8777d07123c8f.zip
fix -o port=xxx
Notes
Notes: svn path=/head/; revision=74790
Diffstat (limited to 'sbin/mount_nfs')
-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 c1d746616901..19f8fa506938 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);