summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/rpm/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/rpm/__init__.py b/python/rpm/__init__.py
index 82e5f4667..56a72950f 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)