diff options
author | Aurelien Campeas <devnull@localhost> | 2009-09-09 11:17:48 +0200 |
---|---|---|
committer | Aurelien Campeas <devnull@localhost> | 2009-09-09 11:17:48 +0200 |
commit | cb6937f54b610436e1e0d2c74fe82d142834e726 (patch) | |
tree | e0b520abce679f00cfd9ca4c66958fd5fbde2623 /graph.py | |
parent | f819e856e6bd9e09797c2480c310c7e5c51b0f23 (diff) | |
download | logilab-common-cb6937f54b610436e1e0d2c74fe82d142834e726.tar.gz |
fix file descriptor leak with an incorrect use of mkstemp
Diffstat (limited to 'graph.py')
-rw-r--r-- | graph.py | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -82,12 +82,15 @@ class DotBackend: storedir, basename, target = target_info_from_filename(outputfile) if target != "dot": pdot, dot_sourcepath = tempfile.mkstemp(".dot", name) + os.close(pdot) else: dot_sourcepath = osp.join(storedir, dotfile) else: target = 'png' pdot, dot_sourcepath = tempfile.mkstemp(".dot", name) ppng, outputfile = tempfile.mkstemp(".png", name) + os.close(pdot) + os.close(ppng) pdot = open(dot_sourcepath,'w') if isinstance(self.source, unicode): pdot.write(self.source.encode('UTF8')) @@ -97,11 +100,7 @@ class DotBackend: if target != 'dot': subprocess.call('%s -T%s %s -o%s' % (self.renderer, target, dot_sourcepath, outputfile), shell=True) - try: - os.unlink(dot_sourcepath) - except OSError: - if sys.platform != 'win32': - raise + os.unlink(dot_sourcepath) return outputfile def emit(self, line): |