]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: fix fd leak during "rados import"
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 25 May 2016 08:04:40 +0000 (16:04 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 18 Jun 2016 03:35:47 +0000 (11:35 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/tools/rados/rados.cc

index 15ea2b60f8aa976023d5eb8b61e1d195c44ff00c..9d200675225619d0eb7d4012073805784b6bfbaf 100644 (file)
@@ -3261,6 +3261,11 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     }
 
     ret = RadosImport(file_fd, 0, dry_run).import(io_ctx, no_overwrite);
+
+    if (file_fd != STDIN_FILENO) {
+      VOID_TEMP_FAILURE_RETRY(::close(file_fd));
+    }
+
     if (ret < 0) {
       cerr << "error from import: "
           << cpp_strerror(ret) << std::endl;