1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-30 19:31:26 +00:00

Merge pull request #507 from zhkl0228/master

Bug fix for sdk initializer.
This commit is contained in:
Marcel Bokhorst 2018-01-06 08:50:36 +01:00 committed by GitHub
commit 594e2001b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -98,6 +98,7 @@ JNIEXPORT jlong JNICALL
Java_eu_faircode_netguard_ServiceSinkhole_jni_1init(
JNIEnv *env, jobject instance, jint sdk) {
struct context *ctx = calloc(1, sizeof(struct context));
ctx->sdk = sdk;
loglevel = ANDROID_LOG_WARN;
@ -408,7 +409,7 @@ void report_error(const struct arguments *args, jint error, const char *fmt, ...
static jmethodID midProtect = NULL;
int protect_socket(const struct arguments *args, int socket) {
if (args->sdk >= 21)
if (args->ctx->sdk >= 21)
return 0;
jclass cls = (*args->env)->GetObjectClass(args->env, args->instance);

View file

@ -73,14 +73,13 @@ struct context {
pthread_mutex_t lock;
int pipefds[2];
int stopping;
int tun;
int sdk;
struct ng_session *ng_session;
};
struct arguments {
JNIEnv *env;
jobject instance;
int sdk;
int tun;
jboolean fwd53;
jint rcode;