Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sys_lseek return offset location #1355

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions manticore/platforms/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,19 +1248,17 @@ def sys_lseek(self, fd, offset, whence):
SEEK_CUR: The file offset is set to its current location plus offset bytes.
SEEK_END: The file offset is set to the size of the file plus offset bytes.

:return: 0 (Success), or EBADF (fd is not a valid file descriptor or is not open)
:return: offset from file beginning, or EBADF (fd is not a valid file descriptor or is not open)

'''
signed_offset = self._to_signed_dword(offset)
try:
self._get_fd(fd).seek(signed_offset, whence)
return self._get_fd(fd).seek(signed_offset, whence)
except FdError as e:
logger.info(("LSEEK: Not valid file descriptor on lseek."
"Fd not seekable. Returning EBADF"))
return -e.err

return 0

def sys_read(self, fd, buf, count):
data: bytes = bytes()
if count != 0:
Expand Down