mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 18:06:13 +01:00
do not crash on reading rpms (missuse of filname as file object)
This commit is contained in:
parent
c48cc43d1a
commit
c18adb7edf
@ -62,7 +62,7 @@ class RpmQuery(packagequery.PackageQuery):
|
||||
|
||||
def __init__(self, fh):
|
||||
self.__file = fh
|
||||
self.__file = os.path.abspath(fh.name)
|
||||
self.__filename = os.path.abspath(fh.name)
|
||||
self.filename_suffix = 'rpm'
|
||||
self.header = None
|
||||
|
||||
@ -224,7 +224,11 @@ class RpmQuery(packagequery.PackageQuery):
|
||||
def query(filename):
|
||||
f = open(filename, 'rb')
|
||||
rpmq = RpmQuery(f)
|
||||
rpmq.read()
|
||||
if rpmq:
|
||||
rpmq.read()
|
||||
else:
|
||||
print "Failed to read", filename, "as rpm"
|
||||
sys.exit(2)
|
||||
f.close()
|
||||
return rpmq
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user