mirror of
https://github.com/ceph/ceph
synced 2025-03-09 17:59:10 +00:00
ceph_objectstore_tool: Make --file option consistent by treating "-" as stdout/stdin
Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
parent
0d5262ac2f
commit
8c87f3284f
@ -1939,9 +1939,9 @@ int main(int argc, char **argv)
|
||||
|
||||
file_fd = fd_none;
|
||||
if (op == "export") {
|
||||
if (!vm.count("file")) {
|
||||
if (!vm.count("file") || file == "-") {
|
||||
if (outistty) {
|
||||
cerr << "stdout is a tty and no --file option specified" << std::endl;
|
||||
cerr << "stdout is a tty and no --file filename specified" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
file_fd = STDOUT_FILENO;
|
||||
@ -1949,9 +1949,9 @@ int main(int argc, char **argv)
|
||||
file_fd = open(file.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0666);
|
||||
}
|
||||
} else if (op == "import") {
|
||||
if (!vm.count("file")) {
|
||||
if (!vm.count("file") || file == "-") {
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
cerr << "stdin is a tty and no --file option specified" << std::endl;
|
||||
cerr << "stdin is a tty and no --file filename specified" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
file_fd = STDIN_FILENO;
|
||||
|
Loading…
Reference in New Issue
Block a user