]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fix merge-diff for >2GB diff-files 6889/head
authorYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Thu, 10 Dec 2015 14:13:38 +0000 (22:13 +0800)
committerYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Thu, 10 Dec 2015 15:10:36 +0000 (23:10 +0800)
from http://tracker.ceph.com/issues/14030

Fixes: #14030
Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
src/tools/rbd/action/MergeDiff.cc

index 9e08a3729f09d9fe36957f07302c43c9e78a6947..eb3f3a3741a5ea91649abf005067e570a0871f8c 100644 (file)
@@ -1,6 +1,10 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
+#define _LARGEFILE64_SOURCE
+#include <sys/types.h>
+#include <unistd.h>
+
 #include "tools/rbd/ArgumentTypes.h"
 #include "tools/rbd/Shell.h"
 #include "tools/rbd/Utils.h"
@@ -336,7 +340,8 @@ static int do_merge_diff(const char *first, const char *second,
           bufferptr bp = buffer::create(delta);
           r = safe_read_exact(fd, bp.c_str(), delta);
         } else {
-          r = lseek(fd, delta, SEEK_CUR);
+          off64_t l = lseek64(fd, delta, SEEK_CUR);
+          r = l < 0 ? -errno : 0;
         }
         if (r < 0) {
           std::cerr << "rbd: failed to skip first diff data" << std::endl;