diff --git a/cocos/platform/CCPosixFileStream.cpp b/cocos/platform/CCPosixFileStream.cpp index 2b48b89b09..40ded86893 100644 --- a/cocos/platform/CCPosixFileStream.cpp +++ b/cocos/platform/CCPosixFileStream.cpp @@ -151,7 +151,8 @@ int PosixFileStream::close() int PosixFileStream::seek(long offset, int origin) { - return static_cast(_iof->seek(_handle, offset, origin)); + const auto result = _iof->seek(_handle, offset, origin); // this returns -1 for error, and resulting offset on success + return result < 0 ? -1 : 0; // return 0 for success } int PosixFileStream::read(void* buf, unsigned int size)