[PATCH 1 of 4] convert: fix a file descriptor leak
Matt Harbison
mharbison72 at gmail.com
Wed Sep 26 04:06:01 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1537929978 14400
# Tue Sep 25 22:46:18 2018 -0400
# Node ID 9403d51284f4cab9b143612157c747fe13382c5b
# Parent 7a9e2d85f475b1675da537ece26419887f9d8b4e
convert: fix a file descriptor leak
test-check-code flagged this after I changed this line for something unrelated.
diff --git a/hgext/convert/gnuarch.py b/hgext/convert/gnuarch.py
--- a/hgext/convert/gnuarch.py
+++ b/hgext/convert/gnuarch.py
@@ -18,6 +18,7 @@ from mercurial import (
encoding,
error,
pycompat,
+ util,
)
from mercurial.utils import (
dateutil,
@@ -228,7 +229,7 @@ class gnuarch_source(common.converter_so
else:
mode = ''
else:
- data = open(os.path.join(self.tmppath, name), 'rb').read()
+ data = util.readfile(os.path.join(self.tmppath, name))
mode = (mode & 0o111) and 'x' or ''
return data, mode
More information about the Mercurial-devel
mailing list