diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-15 09:28:18 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-15 09:28:18 +0000 |
commit | 0474f1be4516b74635b21bba729a04273ea31d41 (patch) | |
tree | 9be556f5f8912fdd8525e29e10c3a69b4c150c7f | |
parent | 6d5a0e912a176b6c2bc8633cacecddecc3c576e2 (diff) | |
parent | 2634ebada8f9b099c4b64e7c129f801a3229d7ef (diff) | |
download | bsdiff-0474f1be4516b74635b21bba729a04273ea31d41.tar.gz |
Merge "Fix A/B update fail for 32-bit devices"
-rw-r--r-- | bsdiff.gyp | 3 | ||||
-rw-r--r-- | file.cc | 6 | ||||
-rw-r--r-- | include/bsdiff/file_interface.h | 3 |
3 files changed, 7 insertions, 5 deletions
@@ -27,6 +27,9 @@ # "bsdiff/...". '<(platform2_root)/../aosp/external', ], + 'defines': [ + '_FILE_OFFSET_BITS=64', + ], }, 'targets': [ # bsdiff static library @@ -64,11 +64,7 @@ bool File::Seek(off_t pos) { errno = EBADF; return false; } - // fseek() uses a long value for the offset which could be smaller than off_t. - if (pos > std::numeric_limits<long>::max()) { - errno = EOVERFLOW; - return false; - } + off_t newpos = lseek(fd_, pos, SEEK_SET); if (newpos < 0) return false; diff --git a/include/bsdiff/file_interface.h b/include/bsdiff/file_interface.h index 1f33147..fe10e98 100644 --- a/include/bsdiff/file_interface.h +++ b/include/bsdiff/file_interface.h @@ -12,6 +12,9 @@ #include "bsdiff/common.h" +static_assert(sizeof(off_t) == sizeof(int64_t), + "off_t must be a 64-bit number, use -D_FILE_OFFSET_BITS=64"); + namespace bsdiff { class BSDIFF_EXPORT FileInterface { |