]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix sanity check of preadv/pwritev 9536/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 7 Jun 2016 06:20:32 +0000 (14:20 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 7 Jun 2016 06:26:45 +0000 (14:26 +0800)
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 <xie.xingguo@zte.com.cn>
src/client/Client.cc

index 31cc936bce8dc43d0e2cf3d5756b00db7af4cf61..dcc8877c6e83694e49db58f2d5166e416b37011f 100644 (file)
@@ -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);
 }