tame: Create guard parent directory

It may not exist on certain systems (e.g. build containers).
master
Mike Gerwitz 2019-04-04 14:52:36 -04:00
parent 1a35232bd8
commit 6f5796238a
1 changed files with 5 additions and 2 deletions

View File

@ -299,6 +299,9 @@ start-tamed-safe()
local -r root=${1?Missing root}
local -ri timeout=5
local -r guard="$root-guard"
mkdir -p "$( dirname "$root" )"
(
flock -w $timeout 6 || {
@ -309,8 +312,8 @@ start-tamed-safe()
_start-tamed "$root"
flock -u 6
rm -f "$root-guard"
) 6>"$root-guard"
rm -f "$guard"
) 6>"$guard"
}