[tor-commits] [orbot/master] improve process lookup code

n8fr8 at torproject.org n8fr8 at torproject.org
Tue Apr 15 04:49:04 UTC 2014


commit 06d5a6fc092062ca507d5702120ed38f406ac00e
Author: Nathan Freitas <nathan at freitas.net>
Date:   Tue Apr 15 00:24:55 2014 -0400

    improve process lookup code
---
 src/org/torproject/android/service/TorServiceUtils.java |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/org/torproject/android/service/TorServiceUtils.java b/src/org/torproject/android/service/TorServiceUtils.java
index 7b6df59..5e87cb5 100644
--- a/src/org/torproject/android/service/TorServiceUtils.java
+++ b/src/org/torproject/android/service/TorServiceUtils.java
@@ -73,12 +73,12 @@ public class TorServiceUtils implements TorServiceConstants {
 		    	
 		Process procPs = null;
 		
-		String processKey = '/' + new File(command).getName();
+		String processKey = new File(command).getName();
 		
-        procPs = r.exec(SHELL_CMD_PS);
+        procPs = r.exec(SHELL_CMD_PS + ' ' + processKey); // this is the android ps <name> command
             
         BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream()));
-        String line = null;
+        String line = reader.readLine(); //read first line "headers" USER PID PPID etc
         
         while ((line = reader.readLine())!=null)
         {





More information about the tor-commits mailing list