Skip to content

Commit

Permalink
Merge pull request #9290 from xiexingguo/xxg-wip-replicatedpg-cleaner
Browse files Browse the repository at this point in the history
tools: do not closed stdout ; fix overload of "<" operator

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
yuriw committed Jul 26, 2016
2 parents 296e485 + d046dce commit f387172
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/tools/RadosDump.cc
Expand Up @@ -62,7 +62,7 @@ int RadosDump::get_footer(footer *f)
bytes = ebl.read_fd(file_fd, sh.footer_size);
if ((size_t)bytes != sh.footer_size) {
cerr << "Unexpected EOF" << std::endl;
return EFAULT;
return -EFAULT;
}

f->decode(ebliter);
Expand Down
13 changes: 12 additions & 1 deletion src/tools/rados/rados.cc
Expand Up @@ -454,7 +454,8 @@ static int do_put(IoCtx& io_ctx, RadosStriper& striper,
}
ret = 0;
out:
VOID_TEMP_FAILURE_RETRY(close(fd));
if (fd != STDOUT_FILENO)
VOID_TEMP_FAILURE_RETRY(close(fd));
delete[] buf;
return ret;
}
Expand Down Expand Up @@ -3348,6 +3349,11 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
}

ret = PoolDump(file_fd).dump(&io_ctx);

if (file_fd != STDIN_FILENO) {
VOID_TEMP_FAILURE_RETRY(::close(file_fd));
}

if (ret < 0) {
cerr << "error from export: "
<< cpp_strerror(ret) << std::endl;
Expand Down Expand Up @@ -3393,6 +3399,11 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
}

ret = RadosImport(file_fd, 0, dry_run).import(io_ctx, no_overwrite);

if (file_fd != STDIN_FILENO) {
VOID_TEMP_FAILURE_RETRY(::close(file_fd));
}

if (ret < 0) {
cerr << "error from import: "
<< cpp_strerror(ret) << std::endl;
Expand Down
22 changes: 1 addition & 21 deletions src/tools/radosacl.cc
Expand Up @@ -52,7 +52,7 @@ typedef __u32 ACLFlags;

inline bool operator<(const ACLID& l, const ACLID& r)
{
return (memcmp(&l, &r, ID_SIZE) > 0);
return (memcmp(&l, &r, ID_SIZE) < 0);
}

struct ACLPair {
Expand Down Expand Up @@ -176,26 +176,6 @@ int main(int argc, const char **argv)
cout << "read result=" << bl2.c_str() << std::endl;
cout << "size=" << size << std::endl;

#if 0
Rados::ListCtx ctx;
int entries;
do {
list<object_t> vec;
r = rados.list(io_ctx, 2, vec, ctx);
entries = vec.size();
cout << "list result=" << r << " entries=" << entries << std::endl;
list<object_t>::iterator iter;
for (iter = vec.begin(); iter != vec.end(); ++iter) {
cout << *iter << std::endl;
}
} while (entries);
#endif
#if 0
r = rados.remove(io_ctx, oid);
cout << "remove result=" << r << std::endl;
rados.close_io_ctx(io_ctx);
#endif

return 0;
}

0 comments on commit f387172

Please sign in to comment.