Commit c28f6e86 authored by Brenden Blanco's avatar Brenden Blanco

Fix file desc leak in test_tools_smoke

Signed-off-by: default avatarBrenden Blanco <bblanco@gmail.com>
parent 3613ff82
......@@ -52,12 +52,12 @@ class SmokeTests(TestCase):
or (rc == 137 and kill), "rc was %d" % rc)
def kmod_loaded(self, mod):
mods = open("/proc/modules", "r")
reg = re.compile("^%s\s" % mod)
for line in mods:
if reg.match(line):
return 1
return 0
with open("/proc/modules", "r") as mods:
reg = re.compile("^%s\s" % mod)
for line in mods:
if reg.match(line):
return 1
return 0
def setUp(self):
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment