From 45efd19722dc99ca55a0f36473c73e0df4dd14e0 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 7 Jun 2016 14:20:32 +0800 Subject: [PATCH] client: fix sanity check of preadv/pwritev The preadv/pwritev call is only supposed to return a postive number indicating how many bytes we succeed in reading from or writing into disk, which is obviously not what we want under the following cases. Signed-off-by: xie xingguo --- src/client/Client.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 31cc936bce8..dcc8877c6e8 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7903,7 +7903,7 @@ int Client::read(int fd, char *buf, loff_t size, loff_t offset) int Client::preadv(int fd, const struct iovec *iov, int iovcnt, loff_t offset) { if (iovcnt < 0) - return EINVAL; + return -EINVAL; return _preadv_pwritev(fd, iov, iovcnt, offset, false); } @@ -8244,7 +8244,7 @@ int Client::write(int fd, const char *buf, loff_t size, loff_t offset) int Client::pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset) { if (iovcnt < 0) - return EINVAL; + return -EINVAL; return _preadv_pwritev(fd, iov, iovcnt, offset, true); } -- 2.47.3