[gnome-ostree/wip/new-model: 3/12] buildutil: Ensure that we don't stomp on anybody else's symlinks



commit 52a393dbff696ef88cdf2aae2703ad76ec010793
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 19 14:55:39 2013 -0400

    buildutil: Ensure that we don't stomp on anybody else's symlinks
    
    If two processes try to make atomic symlinks at the same time, we
    need to not step on each other's toes. Use a non-constant name for
    the tmpfile.

 src/js/buildutil.js |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/js/buildutil.js b/src/js/buildutil.js
index ae78ab8..e4567b5 100644
--- a/src/js/buildutil.js
+++ b/src/js/buildutil.js
@@ -102,7 +102,8 @@ function compareVersions(a, b) {
 
 function atomicSymlinkSwap(linkPath, newTarget, cancellable) {
     let parent = linkPath.get_parent();
-    let tmpLinkPath = parent.get_child('current-new.tmp');
+    let name = linkPath.get_basename();
+    let tmpLinkPath = parent.get_child(name + '-new.tmp');
     GSystem.shutil_rm_rf(tmpLinkPath, cancellable);
     let relpath = parent.get_relative_path(newTarget);
     tmpLinkPath.make_symbolic_link(relpath, cancellable);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]