Skip to content

Commit

Permalink
tools/rados: improve the ls command usage
Browse files Browse the repository at this point in the history
Signed-off-by: Li Wang <[email protected]>
  • Loading branch information
dragonylffly committed Apr 20, 2018
1 parent 5c4f8c7 commit 3bfd9e4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tools/rados/rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2211,12 +2211,17 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,

if (wildcard)
io_ctx.set_namespace(all_nspaces);
bool use_stdout = (nargs.size() < 2) || (strcmp(nargs[1], "-") == 0);
bool use_stdout = (!output && (nargs.size() < 2 || (strcmp(nargs[1], "-") == 0)));
if (!use_stdout && !output) {
cerr << "Please use --output to specify the output file name" << std::endl;
ret = -1;
goto out;
}
ostream *outstream;
if(use_stdout)
outstream = &cout;
else
outstream = new ofstream(nargs[1]);
outstream = new ofstream(output);

{
if (formatter)
Expand Down

0 comments on commit 3bfd9e4

Please sign in to comment.