Skip to contentSkip to conversation

FileJournal: correctly check return value of lseek in write_fd

PATCH New Jim Schutt 1 participant 1 message Sep 27, 2012

lore
Share & tools
lore

Jim Schutt

author
#0 lore raw

PATCH 1/1 FileJournal: correctly check return value of lseek in write_fd

---
 src/os/FileJournal.cc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
src/os/FileJournal.cc +3 -2
index d1c92dc..2254720 100644
@@ -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;
Signature · 1 line
1.7.8.2