1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

fix -o port=xxx

This commit is contained in:
Alfred Perlstein 2001-03-25 19:18:43 +00:00
parent 35910bd13e
commit 12d6e650c6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74790

View File

@ -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);