[tor-commits] [arm/release] fix: fixing tor process detection for openbsd

atagar at torproject.org atagar at torproject.org
Sun Apr 29 04:00:58 UTC 2012


commit 84cd622e515c97d0c9b0d9779204155978926e9d
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Oct 7 09:18:14 2011 -0700

    fix: fixing tor process detection for openbsd
    
    OpenBSD uses a different variant of ps causing the tor process detection (among
    many other things) to fail. Caught thanks to a test system from Jordi Clofent.
---
 src/util/torTools.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index 8e2d6d5..34c9adc 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -352,6 +352,19 @@ def isTorRunning():
   
   # suggestions welcome for making this more reliable
   commandResults = sysTools.call("ps -A co command")
+  
+  if not commandResults:
+    # OpenBSD uses a weird (and largely broken from the looks of it) version of
+    # ps. It lacks the -A argument and according to the man page -j, -l, and -u
+    # all do something similar but they fail.
+    #
+    # ucomm is defined in the man page as 'Alias: comm.  Name to be used for
+    # accounting.' The alias part is a lie (it works, but with an error
+    # message), though this seems to do what we want and prints the bare
+    # command.
+    
+    commandResults = sysTools.call("ps -o ucomm=")
+  
   if commandResults:
     for cmd in commandResults:
       if cmd.strip() == "tor": return True





More information about the tor-commits mailing list