From 7324a69d62f56faa9a621b0554723be85b6cac13 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 15 Oct 2009 11:36:46 +0300 Subject: [PATCH] Use fd.tell() instead of going around through os.lseek() with fdno --- python/rpm/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/rpm/__init__.py b/python/rpm/__init__.py index 82e5f46..56a7295 100644 --- a/python/rpm/__init__.py +++ b/python/rpm/__init__.py @@ -55,12 +55,12 @@ def readHeaderListFromFile(path, retrofit = True): def readHeaderFromFD(file_desc): if not isinstance(file_desc, fd): file_desc = fd(file_desc) - offset = os.lseek(file_desc.fileno(), 0, os.SEEK_CUR) try: + offset = file_desc.tell() h = hdr(file_desc) - except _rpm.error: - h = None + except (_rpm.error, IOError): offset = None + h = None return (h, offset) -- 2.7.4