From cd0d72e6e5e47ebc3c2d5dd723aa9244748eeafc Mon Sep 17 00:00:00 2001
From: =?utf8?q?Paul=20H=C3=A4nsch?= <paul@plutz.net>
Date: Mon, 7 Sep 2020 04:31:56 +0200
Subject: [PATCH] avoid race condition by using per-process temp files

---
 therapies/update_therapy.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/therapies/update_therapy.sh b/therapies/update_therapy.sh
index 70fdea2..0474b3b 100755
--- a/therapies/update_therapy.sh
+++ b/therapies/update_therapy.sh
@@ -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
-- 
2.39.5