static int write_vc(void *ctp, void *buf, int len) { struct sockaddr sa; socklen_t sal; struct ct_data *ct = (struct ct_data *)ctp; int i, cnt; sal = sizeof(sa); if ((_getpeername(ct->ct_fd, &sa, &sal) == 0) && (sa.sa_family == AF_LOCAL)) { for (cnt = len; cnt > 0; cnt -= i, buf = (char *)buf + i) { if ((i = __msgwrite(ct->ct_fd, buf, (size_t)cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; return (-1); } } } else { for (cnt = len; cnt > 0; cnt -= i, buf = (char *)buf + i) { if ((i = _write(ct->ct_fd, buf, (size_t)cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; return (-1); } } } return (len); }
/* * writes data to the unix connection. * Any error is fatal and the connection is closed. */ static int writeunix (char *xprtptr, char * buf, int len) { SVCXPRT *xprt = (SVCXPRT *) xprtptr; int i, cnt; for (cnt = len; cnt > 0; cnt -= i, buf += i) { if ((i = __msgwrite (xprt->xp_sock, buf, cnt)) < 0) { ((struct unix_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED; return -1; } } return len; }
static int writeunix (char *ctptr, char *buf, int len) { int i, cnt; struct ct_data *ct = (struct ct_data *) ctptr; for (cnt = len; cnt > 0; cnt -= i, buf += i) { if ((i = __msgwrite (ct->ct_sock, buf, cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; return -1; } } return len; }