]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
filejournal: check lseek64 return value
authorSage Weil <sage@inktank.com>
Mon, 1 Oct 2012 03:46:37 +0000 (20:46 -0700)
committerSage Weil <sage@inktank.com>
Mon, 1 Oct 2012 03:54:44 +0000 (20:54 -0700)
CID 716858: Other violation (CHECKED_RETURN)
At (6): Calling function "lseek64(this->fd, pos, 0)" without checking return value. This library function may fail and return an error code.

Signed-off-by: Sage Weil <sage@inktank.com>
src/os/FileJournal.cc

index 22547208af463c8b651b937305ad0f7fc01da491..34eab4e28c9c239530f9d591a7fd295f517d697f 100644 (file)
@@ -1583,7 +1583,8 @@ void FileJournal::wrap_read_bl(off64_t& pos, int64_t olen, bufferlist& bl)
 #ifdef DARWIN
     ::lseek(fd, pos, SEEK_SET);
 #else
-    ::lseek64(fd, pos, SEEK_SET);
+    int64_t actual = ::lseek64(fd, pos, SEEK_SET);
+    assert(actual == pos);
 #endif
     
     bufferptr bp = buffer::create(len);