- sock = get_socket(saddr, prot, FALSE);
- if (sock == RPC_ANYSOCK && errno == ETIMEDOUT) {
- /*
- * TCP timeout. Bubble up the error to see
- * how it should be handled.
- */
- rpc_createerr.cf_stat = RPC_TIMEDOUT;
- goto out_bad;
+ sock = get_socket(saddr, prot, FALSE, TRUE);
+ if (sock == RPC_ANYSOCK) {
+ if (errno == ETIMEDOUT) {
+ /*
+ * TCP timeout. Bubble up the error to see
+ * how it should be handled.
+ */
+ rpc_createerr.cf_stat = RPC_TIMEDOUT;
+ }
+ return 0;
+ }
+
+ if (caddr) {
+ /* Get the address of our end of this connection */
+ socklen_t len = sizeof(*caddr);
+ if (getsockname(sock, caddr, &len) != 0)
+ caddr->sin_family = 0;