fix -o port=xxx
This commit is contained in:
parent
35910bd13e
commit
12d6e650c6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74790
@ -172,7 +172,7 @@ int retrycnt = DEF_RETRY;
|
|||||||
int opflags = 0;
|
int opflags = 0;
|
||||||
int nfsproto = IPPROTO_UDP;
|
int nfsproto = IPPROTO_UDP;
|
||||||
int mnttcp_ok = 1;
|
int mnttcp_ok = 1;
|
||||||
u_short port_no = 0;
|
char *port_no = "nfs";
|
||||||
enum {
|
enum {
|
||||||
ANY,
|
ANY,
|
||||||
V2,
|
V2,
|
||||||
@ -366,8 +366,11 @@ main(argc, argv)
|
|||||||
nfsargsp->sotype = SOCK_STREAM;
|
nfsargsp->sotype = SOCK_STREAM;
|
||||||
nfsproto = IPPROTO_TCP;
|
nfsproto = IPPROTO_TCP;
|
||||||
}
|
}
|
||||||
if(altflags & ALTF_PORT)
|
if(altflags & ALTF_PORT) {
|
||||||
port_no = atoi(strstr(optarg, "port=") + 5);
|
port_no = strdup(strstr(optarg, "port=") + 5);
|
||||||
|
if (port_no == NULL)
|
||||||
|
err(1, NULL);
|
||||||
|
}
|
||||||
mountmode = ANY;
|
mountmode = ANY;
|
||||||
if(altflags & ALTF_NFSV2)
|
if(altflags & ALTF_NFSV2)
|
||||||
mountmode = V2;
|
mountmode = V2;
|
||||||
@ -641,7 +644,7 @@ getnfsargs(spec, nfsargsp)
|
|||||||
memset(&hints, 0, sizeof hints);
|
memset(&hints, 0, sizeof hints);
|
||||||
hints.ai_flags = AI_NUMERICHOST;
|
hints.ai_flags = AI_NUMERICHOST;
|
||||||
hints.ai_socktype = nfsargsp->sotype;
|
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)) {
|
if ((nfsargsp->flags & NFSMNT_KERB)) {
|
||||||
hints.ai_flags = 0;
|
hints.ai_flags = 0;
|
||||||
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host,
|
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host,
|
||||||
@ -653,7 +656,7 @@ getnfsargs(spec, nfsargsp)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hints.ai_flags = 0;
|
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",
|
warnx("can't get net id for host/nfs: %s",
|
||||||
gai_strerror(ecode));
|
gai_strerror(ecode));
|
||||||
return (0);
|
return (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user