summaryrefslogtreecommitdiff
path: root/src/chroot-tools/distcc-tool
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-19 11:00:09 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-19 14:54:14 -0500
commitec4ae3a3f632979f446366067ba5a9738644bdc0 (patch)
treeb1347fb764ea0ec119e5d3342cd78f537042daa9 /src/chroot-tools/distcc-tool
parent0315f5fce3353ffb86009578f58e21583a37a826 (diff)
distcc-tool: Fix quoting when embeddint a value in a string
Diffstat (limited to 'src/chroot-tools/distcc-tool')
-rwxr-xr-xsrc/chroot-tools/distcc-tool12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool
index 7524e15..5d21a0a 100755
--- a/src/chroot-tools/distcc-tool
+++ b/src/chroot-tools/distcc-tool
@@ -32,6 +32,8 @@ if ! type gettext &>/dev/null; then
gettext() { echo "$@"; }
fi
+q0="$(printf '%q' "$0")" # quoted $0
+
panic() {
echo "$(gettext 'panic: malformed call to internal function')" >&2
exit 1
@@ -50,7 +52,7 @@ print() {
}
usage() {
- print "Usage: %s COMMAND [COMMAND-ARGS]" "$0"
+ print "Usage: %s COMMAND [COMMAND-ARGS]" "$q0"
print "Tool for using distcc within a networkless chroot"
echo
print "Commands:"
@@ -135,7 +137,7 @@ parse_DISTCC_HOSTS() {
;;
# ZEROCONF
+zeroconf)
- error "%s does not support the +zeroconf option" "$0"
+ error "%s does not support the +zeroconf option" "$q0"
exit 1
;;
# TCP_HOST or OLDSTYLE_TCP_HOST
@@ -159,7 +161,7 @@ parse_DISTCC_HOSTS() {
# set up port forwaring
if $forward_ports; then
- socat TCP-LISTEN:${newport},fork SYSTEM:"$0 client $HOSTID ${PORT:-3632}" &
+ socat TCP-LISTEN:${newport},fork SYSTEM:"$q0 client $HOSTID ${PORT:-3632}" &
pids+=($!)
fi
@@ -222,8 +224,8 @@ odaemon() {
local chrootpath=$1
umask 111
- socat UNIX-LISTEN:"$chrootpath/socket",fork SYSTEM:"$0 server" &
- trap "kill -- $!; rm -f '$chrootpath/socket'" EXIT
+ socat UNIX-LISTEN:"$chrootpath/socket",fork SYSTEM:"$q0 server" &
+ trap "kill -- $!; rm -f -- $(printf '%q' "$chrootpath/socket")" EXIT
wait
}