FileJournal: check return value of lseek in write_fd

CID 716859: Other violation (CHECKED_RETURN)At (1): Calling function
"lseek64(this->fd, pos, 0)" without checking return value. This library
function may fail and return an error code.

Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2012-09-25 14:19:49 -07:00
parent 5c8aea783a
commit 8ec08c2dae

View File

@ -946,8 +946,13 @@ int FileJournal::write_bl(off64_t& pos, bufferlist& bl)
{
align_bl(pos, bl);
::lseek64(fd, pos, SEEK_SET);
int ret = bl.write_fd(fd);
int ret = ::lseek64(fd, pos, SEEK_SET);
if (ret) {
ret = -errno;
derr << "FileJournal::write_bl : lseek64 failed " << cpp_strerror(ret) << dendl;
return ret;
}
ret = bl.write_fd(fd);
if (ret) {
derr << "FileJournal::write_bl : write_fd failed: " << cpp_strerror(ret) << dendl;
return ret;