From 74b8449f582a9fedba1d677f9be5b41a8d4ba304 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Mon, 26 Oct 2020 06:29:14 -0700 Subject: [PATCH] Fix lseek() check Since 'pos' is unsigned, we need to tweak the check. Test: TreeHugger Change-Id: I97dcb50fb86196b09b11ba725593e6c83c5586d9 --- fs_mgr/libsnapshot/cow_reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs_mgr/libsnapshot/cow_reader.cpp b/fs_mgr/libsnapshot/cow_reader.cpp index b1667e38d..5fac0ac8f 100644 --- a/fs_mgr/libsnapshot/cow_reader.cpp +++ b/fs_mgr/libsnapshot/cow_reader.cpp @@ -135,7 +135,7 @@ bool CowReader::ParseOps() { } auto& current_op = ops_buffer->data()[current_op_num]; pos = lseek(fd_.get(), GetNextOpOffset(current_op), SEEK_CUR); - if (pos < 0) { + if (pos == uint64_t(-1)) { PLOG(ERROR) << "lseek next op failed"; return false; }