From: David Zafman Date: Tue, 18 Nov 2014 07:23:40 +0000 (-0800) Subject: ceph_objectstore_tool: Make --file option consistent by treating "-" as stdout/stdin X-Git-Tag: v0.80.10~69^2~41 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a58bdee19eb8f02a2800d728d402e76566d7f58;p=ceph.git ceph_objectstore_tool: Make --file option consistent by treating "-" as stdout/stdin Signed-off-by: David Zafman (cherry picked from commit 8c87f3284f87d1121218cb7f41edc81b74c9df29) --- diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index e3d4bc39927..040a82de931 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -1931,9 +1931,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; @@ -1941,9 +1941,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;