diff --git a/src/tools/cephfs/Dumper.cc b/src/tools/cephfs/Dumper.cc index c8e7f846852..536fb5d9d25 100644 --- a/src/tools/cephfs/Dumper.cc +++ b/src/tools/cephfs/Dumper.cc @@ -113,6 +113,7 @@ int Dumper::dump(const char *dump_file) r = safe_write(fd, buf, sizeof(buf)); if (r) { derr << "Error " << r << " (" << cpp_strerror(r) << ") writing journal file header" << dendl; + ::close(fd); return r; } @@ -189,12 +190,14 @@ int Dumper::undump(const char *dump_file) if (trimmed_pos > start) { derr << std::hex << "Invalid header (trimmed 0x" << trimmed_pos << " > expire 0x" << start << std::dec << dendl; + ::close(fd); return -EINVAL; } if (start > write_pos) { derr << std::hex << "Invalid header (expire 0x" << start << " > write 0x" << write_pos << std::dec << dendl; + ::close(fd); return -EINVAL; } @@ -231,6 +234,7 @@ int Dumper::undump(const char *dump_file) r = header_cond.wait(); if (r != 0) { derr << "Failed to write header: " << cpp_strerror(r) << dendl; + ::close(fd); return r; } @@ -274,6 +278,7 @@ int Dumper::undump(const char *dump_file) r = write_cond.wait(); if (r != 0) { derr << "Failed to write header: " << cpp_strerror(r) << dendl; + ::close(fd); return r; }