tools/rados: do not close stdin after put/append from '-'

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>
This commit is contained in:
Sun Yuechi 2026-07-01 02:59:15 -07:00
parent cc1f41c8d2
commit ef0b9f339f

View 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;
}