|
7 | 7 | import mmap |
8 | 8 | import sys |
9 | 9 | import errno |
10 | | - |
11 | | -from cStringIO import StringIO |
| 10 | +import stat |
12 | 11 |
|
13 | 12 | # in py 2.4, StringIO is only StringI, without write support. |
14 | 13 | # Hence we must use the python implementation for this |
15 | 14 | if sys.version_info[1] < 5: |
16 | 15 | from StringIO import StringIO |
| 16 | +else: |
| 17 | + from cStringIO import StringIO |
17 | 18 | # END handle python 2.4 |
18 | 19 |
|
19 | | -try: |
20 | | - import async.mod.zlib as zlib |
21 | | -except ImportError: |
22 | | - import zlib |
23 | | -# END try async zlib |
24 | | - |
25 | 20 | from async import ThreadPool |
26 | 21 | from smmap import ( |
27 | | - StaticWindowMapManager, |
28 | | - SlidingWindowMapManager, |
29 | | - SlidingWindowMapBuffer |
30 | | - ) |
| 22 | + StaticWindowMapManager, |
| 23 | + SlidingWindowMapManager, |
| 24 | + SlidingWindowMapBuffer |
| 25 | + ) |
31 | 26 |
|
32 | 27 | # initialize our global memory manager instance |
33 | 28 | # Use it to free cached (and unused) resources. |
@@ -304,7 +299,7 @@ def open(self, write=False, stream=False): |
304 | 299 | binary = getattr(os, 'O_BINARY', 0) |
305 | 300 | lockmode = os.O_WRONLY | os.O_CREAT | os.O_EXCL | binary |
306 | 301 | try: |
307 | | - fd = os.open(self._lockfilepath(), lockmode, 0600) |
| 302 | + fd = os.open(self._lockfilepath(), lockmode, stat.S_IREAD|stat.S_IWRITE) |
308 | 303 | if not write: |
309 | 304 | os.close(fd) |
310 | 305 | else: |
@@ -373,7 +368,7 @@ def _end_writing(self, successful=True): |
373 | 368 | # assure others can at least read the file - the tmpfile left it at rw-- |
374 | 369 | # We may also write that file, on windows that boils down to a remove- |
375 | 370 | # protection as well |
376 | | - chmod(self._filepath, 0644) |
| 371 | + chmod(self._filepath, stat.S_IREAD|stat.S_IWRITE|stat.S_IRGRP|stat.S_IROTH) |
377 | 372 | else: |
378 | 373 | # just delete the file so far, we failed |
379 | 374 | os.remove(lockfile) |
|
0 commit comments