diff mbox

FileJournal: correctly check return value of lseek in write_fd

Message ID 1348769189-140200-1-git-send-email-jaschut@sandia.gov (mailing list archive)
State New, archived
Headers show

Commit Message

Jim Schutt Sept. 27, 2012, 6:06 p.m. UTC
Signed-off-by: Jim Schutt <jaschut@sandia.gov>
---
 src/os/FileJournal.cc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc
index d1c92dc..2254720 100644
--- a/src/os/FileJournal.cc
+++ b/src/os/FileJournal.cc
@@ -945,9 +945,10 @@  void FileJournal::align_bl(off64_t pos, bufferlist& bl)
 int FileJournal::write_bl(off64_t& pos, bufferlist& bl)
 {
   align_bl(pos, bl);
+  int ret;
 
-  int ret = ::lseek64(fd, pos, SEEK_SET);
-  if (ret) {
+  off64_t spos = ::lseek64(fd, pos, SEEK_SET);
+  if (spos < 0) {
     ret = -errno;
     derr << "FileJournal::write_bl : lseek64 failed " << cpp_strerror(ret) << dendl;
     return ret;