diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-08-03 13:23:54 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-08-04 08:27:40 +1000 |
commit | ac3611f10500d2942d0295c65b3d7b47621609d4 (patch) | |
tree | 03849d4d82a2019c280c4115c9523c3777393a29 | |
parent | 1f5420e7ecb19022236dfe7eb54dea7d508c04c8 (diff) | |
download | nfs-utils-ac3611f10500d2942d0295c65b3d7b47621609d4.tar.gz nfs-utils-ac3611f10500d2942d0295c65b3d7b47621609d4.tar.xz nfs-utils-ac3611f10500d2942d0295c65b3d7b47621609d4.zip |
mount.nfs: Always close the socket at the end of getport()
These days, none of get_socket()'s callers pass an RPC_ANYSOCK on to the
RPC code.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r-- | utils/mount/network.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c index 89cb976..132ff1e 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -210,9 +210,9 @@ out: } /* - * Create a socket that is locally bound to a reserved or non-reserved - * port. For any failures, RPC_ANYSOCK is returned which will cause - * the RPC code to create the socket instead. + * Create a socket that is locally bound to a reserved or non-reserved port. + * + * The caller should check rpc_createerr to determine the cause of any error. */ static int get_socket(struct sockaddr_in *saddr, unsigned int p_prot, unsigned int timeout, int resvp, int conn) @@ -360,8 +360,7 @@ static unsigned short getport(struct sockaddr_in *saddr, else if (port == 0) rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED; } - if (socket != 1) - close(socket); + close(socket); return port; } |