summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-02-27 00:24:08 +0000
committerNick Mathewson <nickm@torproject.org>2004-02-27 00:24:08 +0000
commitc14963aa07a30b2aa6bd82088a3f4d05949f1ced (patch)
tree23c1a2fff6af266c74c87b83b043fa4b4617c20c
parent40a8b340dae9ea1927b6f624113b335a28d728a9 (diff)
downloadtor-c14963aa07a30b2aa6bd82088a3f4d05949f1ced.tar.gz
tor-c14963aa07a30b2aa6bd82088a3f4d05949f1ced.zip
Dont use -eq for =; make TORGROUP and TORUSER independent
svn:r1134
-rw-r--r--contrib/tor.sh.in14
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/tor.sh.in b/contrib/tor.sh.in
index a3ffaaa39d..151d119013 100644
--- a/contrib/tor.sh.in
+++ b/contrib/tor.sh.in
@@ -11,10 +11,14 @@ TORBIN=@BINDIR@/tor
TORPID=@LOCALSTATEDIR@/run/tor/tor.pid
TORLOG=@LOCALSTATEDIR@/log/tor/tor.log
TORCONF=@CONFDIR@/torrc
-if [ "x$TORUSER" -eq "x" ]; then
- TORARGS="--pidfile $TORPID --logfile $TORLOG --runasdaemon 1"
-else
- TORARGS="--pidfile $TORPID --logfile $TORLOG --runasdaemon 1 --user $TORUSER --group $TORGROUP"
+# Strictly speaking, we don't need to su if we have --user and --group.
+# "Belt and suspenders," says jbash.
+TORARGS="--pidfile $TORPID --logfile $TORLOG --runasdaemon 1"
+if [ "x$TORUSER" != "x" ]; then
+ TORARGS="$TORARGS --user $TORUSER"
+fi
+if [ "x$TORGROUP" != "x" ]; then
+ TORARGS="$TORARGS --group $TORGROUP"
fi
RETVAL=0
@@ -27,7 +31,7 @@ case "$1" in
RETVAL=1
else
echo -n "Starting tor..."
- if [ "x$TORUSER" -eq "x" ]; then
+ if [ "x$TORUSER" = "x" ]; then
$TORBIN -f $TORCONF $TORARGS
else
/bin/su -c "$TORBIN -f $TORCONF $TORARGS" $TORUSER