summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Leisner <Martin.Leisner@xerox.com>2008-07-25 14:50:06 -0400
committerSteve Dickson <steved@redhat.com>2008-07-25 14:50:06 -0400
commit7f6ca07a8836dbdf30a227580441b99607639fd4 (patch)
treec0f39774cdd33a049fef0bc5ca671798b2565cc9
parenteddfbf7ac8ecd3f17dc295df6c1dac4bbc6ca846 (diff)
downloadnfs-utils-7f6ca07a8836dbdf30a227580441b99607639fd4.tar.gz
nfs-utils-7f6ca07a8836dbdf30a227580441b99607639fd4.tar.xz
nfs-utils-7f6ca07a8836dbdf30a227580441b99607639fd4.zip
showmount issues
The connect_nb() routne returns zero for success and a negative value for failure which was not being interpreted correctly by the getport() routine. This patch fixes that problem. Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/showmount/showmount.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/showmount/showmount.c b/utils/showmount/showmount.c
index 76bef19..213a573 100644
--- a/utils/showmount/showmount.c
+++ b/utils/showmount/showmount.c
@@ -82,6 +82,8 @@ static void usage(FILE *fp, int n)
*
* tout contains the timeout. It will be modified to contain the time
* remaining (i.e. time provided - time elasped).
+ *
+ * Returns 0 for success
*/
static int connect_nb(int fd, struct sockaddr_in *addr, struct timeval *tout)
{
@@ -177,7 +179,7 @@ static unsigned short getport(struct sockaddr_in *addr,
tout.tv_sec = TIMEOUT_TCP;
ret = connect_nb(sock, &saddr, &tout);
- if (ret == -1) {
+ if (ret < 0) {
close(sock);
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
@@ -352,7 +354,7 @@ int main(int argc, char **argv)
MOUNTPROG, MOUNTVERS, IPPROTO_TCP);
if (server_addr.sin_port) {
ret = connect_nb(msock, &server_addr, 0);
- if (ret != -1)
+ if (ret == 0) /* success */
mclient = clnttcp_create(&server_addr,
MOUNTPROG, MOUNTVERS, &msock,
0, 0);