Skip to content

Commit

Permalink
fix #332: use tailcall for dlsym hook
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Feb 1, 2025
1 parent d950e05 commit a382dd1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ static void overwriteExecPath(NSString *bundlePath) {
if(strcmp(__symbol, MH_EXECUTE_SYM) == 0) {
return (void*)_dyld_get_image_header(appMainImageIndex);
}
return orig_dlsym(appExecutableHandle, __symbol);
__handle = appExecutableHandle;
}

return orig_dlsym(__handle, __symbol);
__attribute__((musttail)) return orig_dlsym(__handle, __symbol);
}

static NSString* invokeAppMain(NSString *selectedApp, NSString *selectedContainer, int argc, char *argv[]) {
Expand Down

0 comments on commit a382dd1

Please sign in to comment.