From 8f065ae2ce2ffd3758ead86ddd6426dfef4d5d8e Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 22 Oct 2010 14:40:13 +0200
Subject: [PATCH] backend.Upload: switch to utils.SafeWriteFile

This allows serialization of updates to a given file, with respect to
other cooperating writers.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/backend.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index 3b8c55089..1d0d15f08 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1699,8 +1699,9 @@ def UploadFile(file_name, data, mode, uid, gid, atime, mtime):
 
   raw_data = _Decompress(data)
 
-  utils.WriteFile(file_name, data=raw_data, mode=mode, uid=uid, gid=gid,
-                  atime=atime, mtime=mtime)
+  utils.SafeWriteFile(file_name, None,
+                      data=raw_data, mode=mode, uid=uid, gid=gid,
+                      atime=atime, mtime=mtime)
 
 
 def WriteSsconfFiles(values):
-- 
GitLab