make sshd_pid static

sigsegv_dump
Greg Alexander 10 years ago
parent e1d43c3208
commit 9cac7ed132

@ -31,7 +31,7 @@ jni_init(JNIEnv *env_)
CLASS(string, "java/lang/String")
CLASS(simplesshdservice, "org/galexander/sshd/SimpleSSHDService")
FIELD(sss_sshd_pid, simplesshdservice, "sshd_pid", "I")
STFIELD(sss_sshd_pid, simplesshdservice, "sshd_pid", "I")
return 1;
}
@ -48,7 +48,7 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_,
if (pid == 0) {
/* XXX - call dropbear main() */
} else {
(*env)->SetIntField(env, this, fid_sss_sshd_pid, pid);
(*env)->SetStaticIntField(env, cl_simplesshdservice, fid_sss_sshd_pid, pid);
}
}
@ -59,7 +59,7 @@ Java_org_galexander_sshd_SimpleSSHDService_stop_1sshd(JNIEnv *env_, jobject this
if (!jni_init(env_)) {
return;
}
pid = (*env)->GetIntField(env, this, fid_sss_sshd_pid);
pid = (*env)->GetStaticIntField(env, cl_simplesshdservice, fid_sss_sshd_pid);
kill(pid, SIGKILL);
(*env)->SetIntField(env, this, fid_sss_sshd_pid, 0);
(*env)->SetStaticIntField(env, cl_simplesshdservice, fid_sss_sshd_pid, 0);
}

@ -5,7 +5,7 @@ import android.content.Intent;
import android.os.IBinder;
public class SimpleSSHDService extends Service {
public int sshd_pid = 0;
public static int sshd_pid = 0;
public int onStartCommand(Intent intent, int flags, int startId) {
if ((intent == null) ||
@ -24,7 +24,7 @@ public class SimpleSSHDService extends Service {
return null;
}
public boolean is_started() {
public static boolean is_started() {
return (sshd_pid != 0);
}

Loading…
Cancel
Save