]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: Make --file option consistent by treating "-" as stdout/stdin
authorDavid Zafman <dzafman@redhat.com>
Tue, 18 Nov 2014 07:23:40 +0000 (23:23 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 18 Nov 2014 08:16:43 +0000 (00:16 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_objectstore_tool.cc

index 2d433916e892055fffd827bc7f44af175466ddc4..b3c854b8013d4585c9f70cbad48031679009f83c 100644 (file)
@@ -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;