diff options
-rw-r--r-- | lib/common.sh | 12 | ||||
-rw-r--r-- | makechrootpkg.in | 4 |
2 files changed, 8 insertions, 8 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 diff --git a/makechrootpkg.in b/makechrootpkg.in index 0164754..a0941b4 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -121,13 +121,13 @@ chroottype=$(stat -f -c %T "$chrootdir") # Lock the chroot we want to use. We'll keep this lock until we exit. # Note this is the same FD number as in mkarchroot -lock_open_write 9 "$copydir" \ +lock_open_write 9 "$copydir.lock" \ "Waiting for existing lock on chroot copy to be released: [$copy]" if [[ ! -d $copydir ]] || $clean_first; then # Get a read lock on the root chroot to make # sure we don't clone a half-updated chroot - lock_open_read 8 "$chrootdir/root" \ + lock_open_read 8 "$chrootdir/root.lock" \ "Waiting for existing lock on clean chroot to be released" stat_busy "Creating clean working copy [$copy]" |