]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
tools/shim: Fix race condition creating linkfarm.stamp
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 29 Aug 2019 17:19:25 +0000 (18:19 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 3 Sep 2019 13:48:45 +0000 (14:48 +0100)
In the case the while loop gets interrupted, the target musn't appear as
up-to-date.  The mov $X.tmp $X must be the last action of the rule.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/firmware/xen-dir/Makefile

index 697bbbd57bc1072a87374e1df63e96f8eeeedd45..df3f5a7006ec52ab126c21f3673a4884fe838d0d 100644 (file)
@@ -32,9 +32,9 @@ linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
                echo $(f) >> linkfarm.stamp.tmp ;)
        cmp -s linkfarm.stamp.tmp linkfarm.stamp && \
                rm linkfarm.stamp.tmp || { \
+               cat linkfarm.stamp.tmp | while read f; \
+                 do rm -f "$(D)/$$f"; ln -s "$(XEN_ROOT)/$$f" "$(D)/$$f"; done; \
                mv linkfarm.stamp.tmp linkfarm.stamp; \
-               cat linkfarm.stamp | while read f; \
-                 do rm -f "$(D)/$$f"; ln -s "$(XEN_ROOT)/$$f" "$(D)/$$f"; done \
                }
 
 # Copy enough of the tree to build the shim hypervisor