Projet

Général

Profil

0001-qommon-storage-in-_atomic_write-do-not-create-temp-f.patch

Benjamin Dauvergne, 22 novembre 2012 16:15

Télécharger (1,09 ko)

Voir les différences:

Subject: [PATCH] qommon/storage: in _atomic_write do not create temp files in the same directory as the final file

 wcs/qommon/storage.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
wcs/qommon/storage.py
51 51
    '''Rewrite a complete file automatically, that is write to new file with
52 52
    temporary name, fsync, then rename to final name. Use threads to remove blocking.'''
53 53
    def doit():
54
        fd, temp = tempfile.mkstemp(dir=os.path.dirname(path), prefix=os.path.basename(path))
54
        dirname = os.path.dirname(path)
55
        fd, temp = tempfile.mkstemp(dir=dirname,
56
                prefix='.tmp-'+os.path.basename(path)+'-')
55 57
        f = os.fdopen(fd, "w")
56 58
        if hasattr(content, 'read'):
57 59
            # file pointer
58
-