| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | from __future__ import unicode_literals | |
| 27 | 27 | import io | |
| 28 | 28 | import os | |
| 29 | + import stat | ||
| 29 | 30 | from itertools import islice | |
| 30 | 31 | from six.moves import range | |
| 31 | 32 | ||
@@ -187,6 +188,8 @@ def load_from(self, fd): | |||
| 187 | 188 | return entries | |
| 188 | 189 | ||
| 189 | 190 | def save(self, filename, encoding, lines=0): | |
| 191 | + fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.TRUNC, | ||
| 192 | + stat.S_IRUSR | stat.S_IWUSR) | ||
| 190 | 193 | with io.open(filename, 'w', encoding=encoding, | |
| 191 | 194 | errors='ignore') as hfile: | |
| 192 | 195 | with FileLock(hfile): | |
@@ -204,7 +207,9 @@ def append_reload_and_write(self, s, filename, encoding): | |||
| 204 | 207 | return self.append(s) | |
| 205 | 208 | ||
| 206 | 209 | try: | |
| 207 | - with io.open(filename, 'a+', encoding=encoding, | ||
| 210 | + fd = os.open(filename, os.O_APPEND | os.O_RDWR | os.O_CREAT, | ||
| 211 | + stat.S_IRUSR | stat.S_IWUSR) | ||
| 212 | + with io.open(fd, 'a+', encoding=encoding, | ||
| 208 | 213 | errors='ignore') as hfile: | |
| 209 | 214 | with FileLock(hfile): | |
| 210 | 215 | # read entries | |
| Back | FazBrowse Home | New Git URL |
0 commit comments