summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-04-02 10:09:55 +0200
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-04-05 22:11:16 +0200
commitcb35d74f8ce0e1ad489c59d608877e4d6b34ca85 (patch)
tree1e03536795be58879ae0af8964b55545c51b184b /lib
parent14d5e1c21b69975a8d30aba059e1012595d48bba (diff)
downloaddevtools-cb35d74f8ce0e1ad489c59d608877e4d6b34ca85.tar.gz
devtools-cb35d74f8ce0e1ad489c59d608877e4d6b34ca85.tar.xz
Avoid using string interpolation; use printf format strings instead.
This involves extending the signature of lib/common.sh's `stat_busy()`, `lock()`, and `slock()`. The `mesg=$1; shift` in stat_busy even suggests that this is what was originally intended from it.
Diffstat (limited to 'lib')
-rw-r--r--lib/common.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 9303e2e..19aa7de 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -56,7 +56,7 @@ error() {
stat_busy() {
local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2
+ printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2
}
stat_done() {
@@ -142,7 +142,7 @@ get_full_version() {
}
##
-# usage : lock( $fd, $file, $message )
+# usage : lock( $fd, $file, $message, [ $message_arguments... ] )
##
lock() {
# Only reopen the FD if it wasn't handed to us
@@ -152,14 +152,14 @@ lock() {
fi
if ! flock -n $1; then
- stat_busy "$3"
+ stat_busy "${@:3}"
flock $1
stat_done
fi
}
##
-# usage : slock( $fd, $file, $message )
+# usage : slock( $fd, $file, $message, [ $message_arguments... ] )
##
slock() {
# Only reopen the FD if it wasn't handed to us
@@ -169,7 +169,7 @@ slock() {
fi
if ! flock -sn $1; then
- stat_busy "$3"
+ stat_busy "${@:3}"
flock -s $1
stat_done
fi