]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix error import when the input is a pipe 23835/head
authorsongweibin <song.weibin@zte.com.cn>
Fri, 31 Aug 2018 07:41:52 +0000 (15:41 +0800)
committersongweibin <song.weibin@zte.com.cn>
Fri, 31 Aug 2018 12:57:34 +0000 (20:57 +0800)
Fixes: http://tracker.ceph.com/issues/34536
Signed-off-by: songweibin <song.weibin@zte.com.cn>
src/tools/rbd/action/Import.cc

index df724787eb3fe6606ed0526702ff5b99141d213d..25a1670f5a72deaa2f83030ebc97e9d16111c2f5 100644 (file)
@@ -641,7 +641,7 @@ static int decode_imagemeta(int fd, uint64_t length, std::map<std::string, std::
   return 0;
 }
 
-static int do_import_header(int fd, int import_format, uint64_t &size, librbd::ImageOptions& opts,
+static int do_import_header(int fd, int import_format, librbd::ImageOptions& opts,
                             std::map<std::string, std::string>* imagemetas)
 {
   // There is no header in v1 image.
@@ -649,10 +649,6 @@ static int do_import_header(int fd, int import_format, uint64_t &size, librbd::I
     return 0;
   }
 
-  if (fd == STDIN_FILENO || size < utils::RBD_IMAGE_BANNER_V2.size()) {
-    return -EINVAL;
-  }
-
   int r;
   r = validate_banner(fd, utils::RBD_IMAGE_BANNER_V2);
   if (r < 0) {
@@ -886,7 +882,7 @@ static int do_import(librados::Rados &rados, librbd::RBD &rbd,
 #endif
   }
 
-  r = do_import_header(fd, import_format, size, opts, &imagemetas);
+  r = do_import_header(fd, import_format, opts, &imagemetas);
   if (r < 0) {
     std::cerr << "rbd: import header failed." << std::endl;
     goto done;