Skip to contentSkip to conversation

mount.nfs: Always close the socket at the end of getport()

PATCH In review Chuck Lever 1 participant 1 message Aug 3, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/10 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.

---

 utils/mount/network.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
utils/mount/network.c +4 -5
index 89cb976..132ff1e 100644
@@ -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;
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs