lib/oe/qa: check that a path is a file before opening it
PATCH 1/1 lib/oe/qa: check that a path is a file before opening it
Check that a filename points to a normal file before attempting to open it, as if the file turns out to be something more exotic like a FIFO it could hang forever.
Signed-off-by Ross Burton <[email protected]>
--- meta/lib/oe/qa.py | 4 ++++ 1 file changed, 4 insertions(+)
meta/lib/oe/qa.py +4 -0
@@ -31,6 +31,10 @@ class ELFFile: self.objdump_output = {} def open(self): + import os.path + if not os.path.isfile(self.name): + raise Exception("File is not a normal file") + self.file = file(self.name, "r") self.data = self.file.read(ELFFile.EI_NIDENT+4)
Signature · 1 line
2.7.0