|
|
42131c |
diff --git a/src/clnt_vc.c b/src/clnt_vc.c
|
|
|
42131c |
index 61264d4..ebe28f8 100644
|
|
|
42131c |
--- a/src/clnt_vc.c
|
|
|
42131c |
+++ b/src/clnt_vc.c
|
|
|
42131c |
@@ -72,6 +72,8 @@
|
|
|
42131c |
#define CMGROUP_MAX 16
|
|
|
42131c |
#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
|
|
|
42131c |
|
|
|
42131c |
+#undef rpc_createerr /* make it clear it is a thread safe variable */
|
|
|
42131c |
+
|
|
|
42131c |
/*
|
|
|
42131c |
* Credentials structure, used to verify the identity of a peer
|
|
|
42131c |
* process that has sent us a message. This is allocated by the
|
|
|
42131c |
@@ -188,10 +190,11 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
|
|
42131c |
cl = (CLIENT *)mem_alloc(sizeof (*cl));
|
|
|
42131c |
ct = (struct ct_data *)mem_alloc(sizeof (*ct));
|
|
|
42131c |
if ((cl == (CLIENT *)NULL) || (ct == (struct ct_data *)NULL)) {
|
|
|
42131c |
+ struct rpc_createerr *ce = &get_rpc_createerr();
|
|
|
42131c |
+ ce->cf_stat = RPC_SYSTEMERROR;
|
|
|
42131c |
+ ce->cf_error.re_errno = errno;
|
|
|
42131c |
(void) syslog(LOG_ERR, clnt_vc_errstr,
|
|
|
42131c |
clnt_vc_str, __no_mem_str);
|
|
|
42131c |
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
|
|
42131c |
- rpc_createerr.cf_error.re_errno = errno;
|
|
|
42131c |
goto err;
|
|
|
42131c |
}
|
|
|
42131c |
ct->ct_addr.buf = NULL;
|
|
|
42131c |
@@ -230,26 +233,29 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
|
|
42131c |
assert(vc_cv != (cond_t *) NULL);
|
|
|
42131c |
|
|
|
42131c |
/*
|
|
|
42131c |
- * XXX - fvdl connecting while holding a mutex?
|
|
|
42131c |
+ * Do not hold mutex during connect
|
|
|
42131c |
*/
|
|
|
42131c |
+ mutex_unlock(&clnt_fd_lock);
|
|
|
42131c |
+
|
|
|
42131c |
slen = sizeof ss;
|
|
|
42131c |
if (getpeername(fd, (struct sockaddr *)&ss, &slen) < 0) {
|
|
|
42131c |
if (errno != ENOTCONN) {
|
|
|
42131c |
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
|
|
42131c |
- rpc_createerr.cf_error.re_errno = errno;
|
|
|
42131c |
- mutex_unlock(&clnt_fd_lock);
|
|
|
42131c |
+ struct rpc_createerr *ce = &get_rpc_createerr();
|
|
|
42131c |
+ ce->cf_stat = RPC_SYSTEMERROR;
|
|
|
42131c |
+ ce->cf_error.re_errno = errno;
|
|
|
42131c |
thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
|
|
|
42131c |
goto err;
|
|
|
42131c |
}
|
|
|
42131c |
if (connect(fd, (struct sockaddr *)raddr->buf, raddr->len) < 0){
|
|
|
42131c |
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
|
|
42131c |
- rpc_createerr.cf_error.re_errno = errno;
|
|
|
42131c |
- mutex_unlock(&clnt_fd_lock);
|
|
|
42131c |
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
|
|
|
42131c |
- goto err;
|
|
|
42131c |
+ if (errno != EISCONN) {
|
|
|
42131c |
+ struct rpc_createerr *ce = &get_rpc_createerr();
|
|
|
42131c |
+ ce->cf_stat = RPC_SYSTEMERROR;
|
|
|
42131c |
+ ce->cf_error.re_errno = errno;
|
|
|
42131c |
+ thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
|
|
|
42131c |
+ goto err;
|
|
|
42131c |
+ }
|
|
|
42131c |
}
|
|
|
42131c |
}
|
|
|
42131c |
- mutex_unlock(&clnt_fd_lock);
|
|
|
42131c |
if (!__rpc_fd2sockinfo(fd, &si))
|
|
|
42131c |
goto err;
|
|
|
42131c |
thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
|