diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-06-03 22:34:58 -0600 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-06-03 22:34:58 -0600 |
commit | bf8513ae631484a0c292ad085ea7ede9859f8e0f (patch) | |
tree | 20a11d5897f17e501585ec20028a08cefabfe562 | |
parent | 731154ea8d232f614f32049eb420a85da0a323b1 (diff) | |
download | devtools32-bf8513ae631484a0c292ad085ea7ede9859f8e0f.tar.xz |
lock_open_* fix possible bug caused symlinked directorieslibretools-20130605
If somewhere in the path to ${path}.lock there was a symlink, then it would
fail to inherit the lock from the parent program, and stall.
-rw-r--r-- | lib/common.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/common.sh b/lib/common.sh index 4cf9944..65d6d15 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -115,7 +115,7 @@ lock_open_write() { local msg=$3 # Only reopen the FD if it wasn't handed to us - if [[ $(readlink -f /dev/fd/$fd) != "${path}.lock" ]]; then + if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "${path}.lock")" ]]; then mkdir -p "${path%/*}" eval "exec $fd>${path}.lock" fi @@ -136,7 +136,7 @@ lock_open_read() { local msg=$3 # Only reopen the FD if it wasn't handed to us - if [[ $(readlink -f /dev/fd/$fd) != "${path}.lock" ]]; then + if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "${path}.lock")" ]]; then mkdir -p "${path%/*}" eval "exec $fd>${path}.lock" fi |