# HG changeset patch # User Thomas Arendsen Hein # Date 1208943633 -7200 # Node ID 1eba8e8f2ccecf2d24b802bbe60e2f07b0209234 # Parent 782dbbdfb1d762ed3b6ae22bd14a0b599bec79a0 sshserver: Don't try to close fp if mkstemp failed diff -r 782dbbdfb1d7 -r 1eba8e8f2cce mercurial/sshserver.py --- a/mercurial/sshserver.py Fri Jun 13 12:33:40 2008 +0200 +++ b/mercurial/sshserver.py Wed Apr 23 11:40:33 2008 +0200 @@ -167,7 +167,7 @@ self.respond('') # write bundle data to temporary file because it can be big - + tempname = fp = None try: fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') fp = os.fdopen(fd, 'wb+') @@ -198,8 +198,10 @@ self.lock.release() self.lock = None finally: - fp.close() - os.unlink(tempname) + if fp is not None: + fp.close() + if tempname is not None: + os.unlink(tempname) def do_stream_out(self): streamclone.stream_out(self.repo, self.fout)