rendered paste body__attribute__ ((visibility ("default")))
FILE *fopen(const char *path, const char *mode) {
static FILE *(*orig_fopen)(const char *path, const char *mode) = NULL;
if (!orig_fopen)
orig_fopen = dlsym(RTLD_NEXT, "fopen");
// Sanity check
if (!sethET)
return orig_fopen(path, mode);
unsigned int caller = (unsigned int)__builtin_return_address(0); // return address of calling function
// return NULL if the caller is not et.x86 and the file is eth's library\pk3
if (((caller < seth.textSectionStart) || (caller > seth.textSectionEnd))
&& (strstr(path, ETH_PK3_FILE) || strstr(path, "libETH") || strstr(path, ".sh")))
return NULL;
return orig_fopen(path, mode);
}