Skip to content

Commit cc5a488

Browse files
committed
use cache path for temporary file so rename don't fail if /tmp is in another filesystem
1 parent 78239cd commit cc5a488

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

otsserver/backup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def write_disk_cache(self, chunk, bytes):
140140
cache_path = self.cache_path + '/' + chunk_path
141141
os.makedirs(cache_path, exist_ok=True)
142142
cache_file = cache_path + '/' + chunk_str
143-
temp_file = NamedTemporaryFile(delete=False)
143+
temp_file = NamedTemporaryFile(delete=False, dir=cache_path)
144144
temp_file.write(bytes)
145145
temp_file.close()
146146
os.rename(temp_file.name, cache_file) # rename is atomic

0 commit comments

Comments
 (0)