summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-12-02 20:39:58 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-12-02 20:39:58 -0500
commitad5a0cc59ccf5c0927323db081686f902cbbca28 (patch)
treef5420c78aa543a110229055d22d27873cc5c4412 /lib
parent294543f415c50b7fbcee7e9794cda1ba80bf7fd8 (diff)
lib/common.sh: create directories for locks if they don't exist
Diffstat (limited to 'lib')
-rw-r--r--lib/common.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 5204091..932799e 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -113,6 +113,7 @@ lock_open_write() {
# Only reopen the FD if it wasn't handed to us
if [[ $(readlink -f /dev/fd/$fd) != "${path}.lock" ]]; then
+ mkdir -p "${path%/*}"
eval "exec $fd>${path}.lock"
fi
@@ -133,6 +134,7 @@ lock_open_read() {
# Only reopen the FD if it wasn't handed to us
if [[ $(readlink -f /dev/fd/$fd) != "${path}.lock" ]]; then
+ mkdir -p "${path%/*}"
eval "exec $fd>${path}.lock"
fi