Fix custom checkra1n

This commit is contained in:
Nick Chan committed 2024-05-15 02:00:24 +08:00
1 parent 08fbb60538
commit 0e9cd5e1f6
1 file changed
+4 -13
+4 -13
View File
@@ -40,10 +40,6 @@ int exec_checkra1n(void) {
LOG(LOG_INFO, "About to execute checkra1n"); LOG(LOG_INFO, "About to execute checkra1n");
int fd_checkra1n, fd_pongo, ret; int fd_checkra1n, fd_pongo, ret;
char* checkra1n_path = NULL; char* checkra1n_path = NULL;
if (ext_checkra1n != NULL) {
checkra1n_path = ext_checkra1n;
goto checkra1n_exec;
}
#ifndef NO_CUSTOM_PONGO #ifndef NO_CUSTOM_PONGO
if (pongo_path == NULL) { if (pongo_path == NULL) {
pongo_path = malloc(strlen(tmpdir) + 20); pongo_path = malloc(strlen(tmpdir) + 20);
@@ -69,6 +65,9 @@ int exec_checkra1n(void) {
} }
} else external_pongo = true; } else external_pongo = true;
#endif #endif
if (ext_checkra1n != NULL) {
checkra1n_path = ext_checkra1n;
} else {
checkra1n_path = malloc(strlen(tmpdir) + 20); checkra1n_path = malloc(strlen(tmpdir) + 20);
if (checkra1n_path == NULL) { if (checkra1n_path == NULL) {
LOG(LOG_FATAL, "memory allocation failed\n"); LOG(LOG_FATAL, "memory allocation failed\n");
@@ -100,6 +99,7 @@ int exec_checkra1n(void) {
checkra1n_path = NULL; checkra1n_path = NULL;
return -1; return -1;
} }
}
#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER)) #if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
char* libcheckra1nhelper_dylib_path = NULL; char* libcheckra1nhelper_dylib_path = NULL;
{ {
@@ -146,7 +146,6 @@ setenv_ra1n:
#endif #endif
} }
#endif #endif
checkra1n_exec: {};
char args[0x10] = "-E"; char args[0x10] = "-E";
if ((palerain_flags & palerain_option_demote)) strncat(args, "d", 0xf); if ((palerain_flags & palerain_option_demote)) strncat(args, "d", 0xf);
if (!(palerain_flags & palerain_option_checkrain_is_clone)) { if (!(palerain_flags & palerain_option_checkrain_is_clone)) {
@@ -168,7 +167,6 @@ checkra1n_exec: {};
posix_spawn_file_actions_addopen(&action, 2, "/dev/null", O_WRONLY, 0); posix_spawn_file_actions_addopen(&action, 2, "/dev/null", O_WRONLY, 0);
} }
#endif #endif
if (pongo_path != NULL) {
ret = posix_spawn(&pid, checkra1n_path, &action, NULL, (char* []){ ret = posix_spawn(&pid, checkra1n_path, &action, NULL, (char* []){
checkra1n_path, checkra1n_path,
args, args,
@@ -176,13 +174,6 @@ checkra1n_exec: {};
pongo_path, pongo_path,
NULL NULL
}, environ); }, environ);
} else {
ret = posix_spawn(&pid, checkra1n_path, &action, NULL, (char* []){
checkra1n_path,
args,
NULL
}, environ);
}
posix_spawn_file_actions_destroy(&action); posix_spawn_file_actions_destroy(&action);
if (ret) { if (ret) {
LOG(LOG_FATAL, "Cannot posix spawn %s: %d (%s)", checkra1n_path, errno, strerror(errno)); LOG(LOG_FATAL, "Cannot posix spawn %s: %d (%s)", checkra1n_path, errno, strerror(errno));