fix a crash when timeout in Exec

This commit is contained in:
Max Lv
2012-12-25 20:33:16 +08:00
parent 88ecb02ecf
commit d01295b3f5
3 changed files with 18 additions and 5 deletions
+2 -2
View File
@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:installLocation="auto"
android:versionCode="7"
android:versionName="1.1.3">
android:versionCode="8"
android:versionName="1.1.4">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.shadowsocks</groupId>
<artifactId>shadowsocks</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
<packaging>apk</packaging>
<name>Shadowsocks</name>
+15 -2
View File
@@ -271,6 +271,21 @@ public class Utils {
private final boolean asroot;
public int exitcode = -1;
private int[] pid = new int[1];
private FileDescriptor pipe;
@Override
public void destroy() {
if (pid[0] != -1) {
Exec.hangupProcessGroup(pid[0]);
pid[0] = -1;
}
if (pipe != null) {
Exec.close(pipe);
pipe = null;
}
}
/**
* Creates a new script runner.
*
@@ -344,8 +359,6 @@ public class Utils {
@Override
public void run() {
FileDescriptor pipe = null;
int pid[] = new int[1];
pid[0] = -1;
try {