diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-06-15 11:04:42 -0600 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-06-15 11:04:42 -0600 |
commit | a7587c1289f41d9bed47939780b7e8252000211e (patch) | |
tree | 0274265f923f8c6e90416bcce3be94a0cd3dbfdc /lib/common.sh | |
parent | eba252eca59c3d110e90c97d114bacceca343426 (diff) | |
download | devtools32-a7587c1289f41d9bed47939780b7e8252000211e.tar.xz |
redo the lock functions to not append .lock
mkarchroot.in didn't need modified because it already (incorrectly) had
.lock in the filename
Diffstat (limited to 'lib/common.sh')
-rw-r--r-- | lib/common.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/common.sh b/lib/common.sh index 65d6d15..9f537c7 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -107,7 +107,7 @@ in_array() { } ## -# usage : lock_open_write( $fd, $path, $wait_message ) +# usage : lock_open_write( $fd, $path.lock, $wait_message ) ## lock_open_write() { local fd=$1 @@ -115,9 +115,9 @@ lock_open_write() { local msg=$3 # Only reopen the FD if it wasn't handed to us - if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "${path}.lock")" ]]; then + if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "${path}")" ]]; then mkdir -p "${path%/*}" - eval "exec $fd>${path}.lock" + eval "exec $fd>${path}" fi if ! flock -n $fd; then @@ -128,7 +128,7 @@ lock_open_write() { } ## -# usage : lock_open_read( $fd, $path, $wait_message ) +# usage : lock_open_read( $fd, $path.lock, $wait_message ) ## lock_open_read() { local fd=$1 @@ -136,9 +136,9 @@ lock_open_read() { local msg=$3 # Only reopen the FD if it wasn't handed to us - if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "${path}.lock")" ]]; then + if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "${path}")" ]]; then mkdir -p "${path%/*}" - eval "exec $fd>${path}.lock" + eval "exec $fd>${path}" fi if ! flock -sn $fd; then |