]> git.plutz.net Git - lobster/commitdiff
avoid race condition by using per-process temp files
authorPaul Hänsch <paul@plutz.net>
Mon, 7 Sep 2020 02:31:56 +0000 (04:31 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 7 Sep 2020 02:31:56 +0000 (04:31 +0200)
therapies/update_therapy.sh

index 70fdea2930a23b0391a1ec7b58df693f8e5e8b07..0474b3b3be6d608f4db5975b93b03dc1b21c2c4a 100755 (executable)
@@ -21,7 +21,7 @@
 tpy="$(POST id)"
 
 tpyfile="$_DATA/therapies/${tpy}.tpy"
-tempfile="$_DATA/temp/${tpy}.tpy"
+tempfile="$_DATA/temp/${tpy}.$$.tpy"
 
 if [ "$(POST tid)" != "$(transid "$tpyfile")" ]; then
   if [ "$(POST autosubmit)" = "true" ]; then