[or-cvs] Dont use -eq for =; make TORGROUP and TORUSER independent

Nick Mathewson nickm at seul.org
Fri Feb 27 00:24:10 UTC 2004


Update of /home/or/cvsroot/contrib
In directory moria.mit.edu:/tmp/cvs-serv30696/contrib

Modified Files:
	tor.sh.in 
Log Message:
Dont use -eq for =; make TORGROUP and TORUSER independent

Index: tor.sh.in
===================================================================
RCS file: /home/or/cvsroot/contrib/tor.sh.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- tor.sh.in	27 Feb 2004 00:07:33 -0000	1.2
+++ tor.sh.in	27 Feb 2004 00:24:08 -0000	1.3
@@ -11,10 +11,14 @@
 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 @@
         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



More information about the tor-commits mailing list