Created
September 18, 2012 15:59
-
-
Save jeffniblack/3743906 to your computer and use it in GitHub Desktop.
fstab check for jailbroken iOS devices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/stat.h> | |
static inline int | |
fstab_check(void) | |
__attribute__((always_inline)); | |
int fstab_check(void) { | |
struct stat sb; | |
int result = 1; | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"fstab_check -> Running on the simulator!"); | |
result = 0; | |
#else | |
stat("/etc/fstab", &sb); | |
long long size = sb.st_size; | |
if ([[[UIDevice currentDevice] systemVersion] compare:@"6.0" options:NSNumericSearch] == NSOrderedSame) { | |
if (size == 80) { | |
result = 0; | |
} | |
} else { | |
} | |
if ([[[UIDevice currentDevice] systemVersion] compare:@"5.0" options:NSNumericSearch] == NSOrderedSame) { | |
if (size == 80) { | |
result = 0; | |
} | |
} | |
if ([[[UIDevice currentDevice] systemVersion] compare:@"5.1" options:NSNumericSearch] == NSOrderedSame) { | |
if (size == 80) { | |
result = 0; | |
} | |
} | |
if ([[[UIDevice currentDevice] systemVersion] compare:@"5.1.1" options:NSNumericSearch] == NSOrderedSame) { | |
if (size == 80) { | |
result = 0; | |
} | |
} | |
#endif | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment