diff options
author | Shawn O. Pearce <sop@google.com> | 2009-04-18 14:48:03 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-04-18 14:48:03 -0700 |
commit | 76ca9f8145f367f83df19981da4dd934fdda471b (patch) | |
tree | d6c095928fd2b1131972206b3c3f498843a736a6 /git_refs.py | |
parent | accc56d82b902e7c7a22401db710958fcb1c7b58 (diff) | |
download | git-repo-76ca9f8145f367f83df19981da4dd934fdda471b.tar.gz |
Make usage of open safer by setting binary mode and closing fds
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'git_refs.py')
-rw-r--r-- | git_refs.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/git_refs.py b/git_refs.py index 24760918..ac8ed0c1 100644 --- a/git_refs.py +++ b/git_refs.py | |||
@@ -101,7 +101,7 @@ class GitRefs(object): | |||
101 | def _ReadPackedRefs(self): | 101 | def _ReadPackedRefs(self): |
102 | path = os.path.join(self._gitdir, 'packed-refs') | 102 | path = os.path.join(self._gitdir, 'packed-refs') |
103 | try: | 103 | try: |
104 | fd = open(path, 'r') | 104 | fd = open(path, 'rb') |
105 | mtime = os.path.getmtime(path) | 105 | mtime = os.path.getmtime(path) |
106 | except IOError: | 106 | except IOError: |
107 | return | 107 | return |
@@ -138,7 +138,7 @@ class GitRefs(object): | |||
138 | 138 | ||
139 | def _ReadLoose1(self, path, name): | 139 | def _ReadLoose1(self, path, name): |
140 | try: | 140 | try: |
141 | fd = open(path, 'r') | 141 | fd = open(path, 'rb') |
142 | mtime = os.path.getmtime(path) | 142 | mtime = os.path.getmtime(path) |
143 | except OSError: | 143 | except OSError: |
144 | return | 144 | return |