Skip to content

Instantly share code, notes, and snippets.

@jeffniblack
Created September 18, 2012 15:57
Show Gist options
  • Save jeffniblack/3743902 to your computer and use it in GitHub Desktop.
Save jeffniblack/3743902 to your computer and use it in GitHub Desktop.
fork check for jailbroken iOS devices
static inline int
fork_check(void)
__attribute__((always_inline));
int fork_check(void) {
int result = fork();
if (!result) {
exit(0);
}
if (result >= 0) {
#if TARGET_IPHONE_SIMULATOR
NSLog(@"fork_check -> Running on the simulator!");
return 0;
#else
return 1;
#endif
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment