]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: do not close stdin after put/append from '-'
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 09:59:15 +0000 (02:59 -0700)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 16:46:24 +0000 (09:46 -0700)
do_put()/do_append() set fd to STDIN_FILENO for '-', but cleanup
guarded close() on STDOUT_FILENO (always true), closing stdin.
Guard on STDIN_FILENO instead.

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/tools/rados/rados.cc

index 42103648b6b8a0ec2b152840b62ce3acc9d947dd..118359be5823d1cb8b0fecc1232048bcc904e8a3 100644 (file)
@@ -649,7 +649,7 @@ static int do_put(IoCtx& io_ctx,
   }
   ret = 0;
  out:
-  if (fd != STDOUT_FILENO)
+  if (fd != STDIN_FILENO)
     VOID_TEMP_FAILURE_RETRY(close(fd));
   return ret;
 }
@@ -684,7 +684,7 @@ static int do_append(IoCtx& io_ctx,
   }
   ret = 0;
 out:
-  if (fd != STDOUT_FILENO)
+  if (fd != STDIN_FILENO)
     VOID_TEMP_FAILURE_RETRY(close(fd));
   return ret;
 }