From 36448191b79a5fb51be9d6d479f66f554a61ab50 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 20 May 2018 00:49:48 +0800 Subject: [PATCH] Fix applet invocation --- native/jni/core/magisk.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/native/jni/core/magisk.c b/native/jni/core/magisk.c index f1f241f90..a72a44850 100644 --- a/native/jni/core/magisk.c +++ b/native/jni/core/magisk.c @@ -158,6 +158,15 @@ int magisk_main(int argc, char *argv[]) { write_int(fd, LATE_START); return read_int(fd); } + + // Applets + argc--; + argv++; + for (int i = 0; applet[i]; ++i) { + if (strcmp(basename(argv[0]), applet[i]) == 0) + return (*applet_main[i])(argc, argv); + } + usage(); return 1; }