From d9b54675c53b4d5b41834a762e305615ed48cb49 Mon Sep 17 00:00:00 2001 From: Mark Mossberg Date: Mon, 13 Nov 2017 18:30:23 -0500 Subject: [PATCH] Handle file.tell() error, which will happen for special files (/dev/tty) (#559) --- manticore/platforms/linux.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/manticore/platforms/linux.py b/manticore/platforms/linux.py index 32884be..ad504e3 100644 --- a/manticore/platforms/linux.py +++ b/manticore/platforms/linux.py @@ -53,7 +53,11 @@ class File(object): state = {} state['name'] = self.name state['mode'] = self.mode - state['pos'] = self.tell() + try: + state['pos'] = self.tell() + except IOError: + # This is to handle special files like /dev/tty + state['pos'] = None return state def __setstate__(self, state): @@ -61,7 +65,8 @@ class File(object): mode = state['mode'] pos = state['pos'] self.file = file(name, mode) - self.seek(pos) + if pos is not None: + self.seek(pos) @property def name(self):