diff options
author | Neil Brown <neilb@suse.de> | 2007-02-22 15:34:45 +1100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-02-22 15:34:45 +1100 |
commit | 66d8e2870b8d3e91c27a66ebc85e012a3cda9c69 (patch) | |
tree | 531113664d3a1c5261a0dcc53008392b18123884 /utils/showmount | |
parent | 944011f65513aa4c1b69fa92e0f51b8aef7c1cbc (diff) | |
download | nfs-utils-66d8e2870b8d3e91c27a66ebc85e012a3cda9c69.tar.gz |
Fix showmount bugs.
When doing a nonblocked connect, we need to select for 'write', not 'read'.
Also, when a tcp socket has been connected, we should use clnttcp_create
to make a tcp client, not clntudp_bufcreate !!
Diffstat (limited to 'utils/showmount')
-rw-r--r-- | utils/showmount/showmount.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/showmount/showmount.c b/utils/showmount/showmount.c index 9979621..f3ac671 100644 --- a/utils/showmount/showmount.c +++ b/utils/showmount/showmount.c @@ -118,7 +118,7 @@ static int connect_nb(int fd, struct sockaddr_in *addr, struct timeval *tout) FD_ZERO(&rset); FD_SET(fd, &rset); - ret = select(fd + 1, &rset, NULL, NULL, tout); + ret = select(fd + 1, NULL, &rset, NULL, tout); if (ret <= 0) { if (ret == 0) ret = -ETIMEDOUT; @@ -185,6 +185,9 @@ static unsigned short getport(struct sockaddr_in *addr, rpc_createerr.cf_error.re_errno = errno; return 0; } + client = clnttcp_create(&saddr, + PMAPPROG, PMAPVERS, &sock, + 0, 0); } else { /* * bind to any unused port. If we left this up to the rpc @@ -213,10 +216,10 @@ static unsigned short getport(struct sockaddr_in *addr, sock = RPC_ANYSOCK; /* FALLTHROUGH */ } + client = clntudp_bufcreate(&saddr, PMAPPROG, PMAPVERS, + tout, &sock, send_sz, recv_sz); } - client = clntudp_bufcreate(&saddr, PMAPPROG, PMAPVERS, - tout, &sock, send_sz, recv_sz); if (!client) { close(sock); rpc_createerr.cf_stat = RPC_RPCBFAILURE; |