]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: use min<uint64_t>() explicitly 14202/head
authorKefu Chai <kchai@redhat.com>
Tue, 28 Mar 2017 18:05:07 +0000 (02:05 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 28 Mar 2017 18:26:53 +0000 (02:26 +0800)
on arm32, size_t is actually int, which cannot be compared with uint64_t
using std::min().

Fixes: http://tracker.ceph.com/issues/18938
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/rbd/action/Import.cc

index f012bbbf0b591e77bfadec839b3ae8555ee0cd45..5b9df1271bd9643e8cf282a479f71ac7d67991b6 100644 (file)
@@ -259,13 +259,13 @@ static int skip_tag(int fd, uint64_t length)
   if (fd == STDIN_FILENO) {
     // read the appending data out to skip this tag.
     char buf[4096];
-    uint64_t len = min(length, sizeof(buf));
+    uint64_t len = min<uint64_t>(length, sizeof(buf));
     while (len > 0) {
       r = safe_read_exact(fd, buf, len);
       if (r < 0)
         return r;
       length -= len;
-      len = min(length, sizeof(buf));
+      len = min<uint64_t>(length, sizeof(buf));
     }
   } else {
     // lseek to skip this tag
@@ -606,7 +606,7 @@ static int do_import_v1(int fd, librbd::Image &image, uint64_t size,
                      max(g_conf->rbd_concurrent_management_ops, 1), false));
   }
 
-  reqlen = min(reqlen, size);
+  reqlen = min<uint64_t>(reqlen, size);
   // loop body handles 0 return, as we may have a block to flush
   while ((readlen = ::read(fd, p + blklen, reqlen)) >= 0) {
     if (throttle->pending_error()) {