index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-03-25 12:34:39 -0400 |
---|---|---|
committer | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2017-04-05 22:03:00 +0200 |
commit | d33344081006d3f653651f0895b143c305e9e7c7 (patch) | |
tree | 04807f33567e3c25253af7ead5813e840655fbc9 | |
parent | 997bc1dc0db12ee5791bfb74f07c91ce10ed7cfd (diff) |
-rw-r--r-- | lib/common.sh | 12 |
diff --git a/lib/common.sh b/lib/common.sh index 689772f..63b7795 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 |