summaryrefslogtreecommitdiff
path: root/lib9p/srv.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/srv.c')
-rw-r--r--lib9p/srv.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 580c5f5..932cd4d 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -141,15 +141,9 @@ struct _lib9p_srv_req {
#define nonrespond_errorf errorf
static ssize_t write_Rmsg(struct _lib9p_srv_req *req, struct lib9p_Rmsg_send_buf *resp) {
- ssize_t r = 0, _r;
+ ssize_t r;
cr_mutex_lock(&req->parent_sess->parent_conn->writelock);
- for (size_t i = 0; i < resp->iov_cnt; i++) {
- _r = LO_CALL(req->parent_sess->parent_conn->fd, write,
- resp->iov[i].iov_base, resp->iov[i].iov_len);
- if (_r < 0)
- return _r;
- r += _r;
- }
+ r = io_writev(req->parent_sess->parent_conn->fd, resp->iov, resp->iov_cnt);
cr_mutex_unlock(&req->parent_sess->parent_conn->writelock);
return r;
}
@@ -195,7 +189,7 @@ static bool read_exactly(lo_interface net_stream_conn fd, uint8_t *buf, size_t g
assert(goal);
assert(done);
while (*done < goal) {
- ssize_t r = LO_CALL(fd, read, &buf[*done], goal - *done);
+ ssize_t r = io_read(fd, &buf[*done], goal - *done);
if (r < 0) {
nonrespond_errorf("read: %s", net_strerror(-r));
return true;