]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: fix fd leak during "rados export" 9290/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 25 May 2016 08:22:26 +0000 (16:22 +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 9d200675225619d0eb7d4012073805784b6bfbaf..9b2414de28004b5bc64bf8f8fa696b876a09ec39 100644 (file)
@@ -3216,6 +3216,11 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     }
 
     ret = PoolDump(file_fd).dump(&io_ctx);
+
+    if (file_fd != STDIN_FILENO) {
+      VOID_TEMP_FAILURE_RETRY(::close(file_fd));
+    }
+
     if (ret < 0) {
       cerr << "error from export: "
           << cpp_strerror(ret) << std::endl;