index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <lukeshu@parabola.nu> | 2012-11-25 20:05:09 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2017-02-06 03:14:35 -0500 |
commit | a181e77c492f7cbd454634c6d65151d6bb13ae25 (patch) | |
tree | 25e7852c54887de4a97265683ee4de7c044d3b7f | |
parent | 09bc36a930319d1287c41b78b24acfb36b0a8715 (diff) |
-rw-r--r-- | lib/common.sh | 12 |
diff --git a/lib/common.sh b/lib/common.sh index 91a55dc..70752ff 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -138,7 +138,11 @@ get_full_version() { # usage : lock( $fd, $file, $message ) ## lock() { - eval "exec $1>"'"$2"' + # Only reopen the FD if it wasn't handed to us + if ! [[ "/dev/fd/$1" -ef "$2" ]]; then + eval "exec $1>"'"$2"' + fi + if ! flock -n $1; then stat_busy "$3" flock $1 @@ -150,7 +154,11 @@ lock() { # usage : slock( $fd, $file, $message ) ## slock() { - eval "exec $1>"'"$2"' + # Only reopen the FD if it wasn't handed to us + if ! [[ "/dev/fd/$1" -ef "$2" ]]; then + eval "exec $1>"'"$2"' + fi + if ! flock -sn $1; then stat_busy "$3" flock -s $1 |