Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15:Update
rpmlint
0001-Avoid-calling-close-on-undefined-fd-variab...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Avoid-calling-close-on-undefined-fd-variable.patch of Package rpmlint
From 49611f900047d5397ebbbdb0ed5299580337ea34 Mon Sep 17 00:00:00 2001 From: Dirk Mueller <dirk@dmllr.de> Date: Wed, 1 Nov 2017 13:59:01 +0100 Subject: [PATCH] Avoid calling close on undefined fd variable It can happen that open did through an OSError but then the corresponding close UnknownVariableError wasn't caught. we can fix that by putting both in the same try/exception block, which also cleans up the code a bit. --- Pkg.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Pkg.py b/Pkg.py index 47197c9..2622f9a 100644 --- a/Pkg.py +++ b/Pkg.py @@ -719,16 +719,11 @@ class Pkg(AbstractPkg): # use descriptor() method instead try: fd = os.open(pkgfile.path, os.O_RDONLY) - except OSError: - if not pkgfile.is_ghost: - raise - else: pkgfile.magic = b2s(_magic.descriptor(fd)) - # libmagic up to 5.18 already closes the descriptor - try: os.close(fd) except OSError: - pass + if not pkgfile.is_ghost: + raise if pkgfile.magic is None: pkgfile.magic = '' elif Pkg._magic_from_compressed_re.search(pkgfile.magic): -- 2.14.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor