Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/common.sh32
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/common.sh b/lib/common.sh
index b8bab9b..68b001d 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -162,19 +162,15 @@ get_full_version() {
# usage : lock( $fd, $file, $message, [ $message_arguments... ] )
##
lock() {
- local fd=$1
- local file=$2
- local mesg=("${@:3}")
-
# Only reopen the FD if it wasn't handed to us
- if ! [[ "/dev/fd/$fd" -ef "$file" ]]; then
- mkdir -p "${file%/*}"
- eval "exec $fd>"'"$file"'
+ if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
+ mkdir -p "${2%/*}"
+ eval "exec $1>"'"$2"'
fi
- if ! flock -n $fd; then
- stat_busy "${mesg[@]}"
- flock $fd
+ if ! flock -n $1; then
+ stat_busy "${@:3}"
+ flock $1
stat_done
fi
}
@@ -183,19 +179,15 @@ lock() {
# usage : slock( $fd, $file, $message, [ $message_arguments... ] )
##
slock() {
- local fd=$1
- local file=$2
- local mesg=("${@:3}")
-
# Only reopen the FD if it wasn't handed to us
- if ! [[ "/dev/fd/$fd" -ef "$file" ]]; then
- mkdir -p "${file%/*}"
- eval "exec $fd>"'"$file"'
+ if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
+ mkdir -p "${2%/*}"
+ eval "exec $1>"'"$2"'
fi
- if ! flock -sn $fd; then
- stat_busy "${mesg[@]}"
- flock -s $fd
+ if ! flock -sn $1; then
+ stat_busy "${@:3}"
+ flock -s $1
stat_done
fi
}