]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Always close the socket at the end of getport()
authorChuck Lever <chuck.lever@oracle.com>
Fri, 3 Aug 2007 17:23:54 +0000 (13:23 -0400)
committerNeil Brown <neilb@suse.de>
Fri, 3 Aug 2007 22:27:40 +0000 (08:27 +1000)
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>
utils/mount/network.c

index 89cb976d0fda0309666853d6a7d3baf510827eea..132ff1e763fc4980e6498427f29bc6f5a26cedfb 100644 (file)
@@ -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)
  */
 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;
        }
                else if (port == 0)
                        rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
        }
-       if (socket != 1)
-               close(socket);
+       close(socket);
 
        return port;
 }
 
        return port;
 }