aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2023-08-09 00:28:59 +0200
committerнаб <nabijaczleweli@nabijaczleweli.xyz>2023-08-09 15:58:45 +0200
commit9ae2f8a2293f7e2935b54f51b619ddafd716b070 (patch)
tree468f048bd6828d76e631cbeef60eabf6afe72f08 /contrib
parent3d63d713ea42d1ed1ca4686340cd03f82ba394b7 (diff)
downloadtor-9ae2f8a2293f7e2935b54f51b619ddafd716b070.tar.gz
tor-9ae2f8a2293f7e2935b54f51b619ddafd716b070.zip
Clean up torify
Replace pathfind() which tries to parse $PATH manually with command -v. exec is always fatal, regardless of if it managed to execute.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/client-tools/torify19
1 files changed, 1 insertions, 18 deletions
diff --git a/contrib/client-tools/torify b/contrib/client-tools/torify
index ac4c9b5c7f..94640c0faf 100755
--- a/contrib/client-tools/torify
+++ b/contrib/client-tools/torify
@@ -37,25 +37,8 @@ case $1 in -v|--verbose)
shift
esac
-# taken from Debian's Developer's Reference, 6.4
-pathfind() {
- OLDIFS="$IFS"
- IFS=:
- for p in $PATH; do
- if [ -x "$p/$*" ]; then
- IFS="$OLDIFS"
- return 0
- fi
- done
- IFS="$OLDIFS"
- return 1
-}
-
-if pathfind torsocks; then
+if command -v torsocks > /dev/null; then
exec torsocks "$@"
- echo "$0: Failed to exec torsocks $*" >&2
- exit 1
else
echo "$0: torsocks not found in your PATH. Perhaps it isn't installed? (tsocks is no longer supported, for security reasons.)" >&2
fi
-