Skip to content

Instantly share code, notes, and snippets.

@ZeDoCaixao
Created October 16, 2017 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeDoCaixao/216835f8382c3b974f892121d9c21df8 to your computer and use it in GitHub Desktop.
Save ZeDoCaixao/216835f8382c3b974f892121d9c21df8 to your computer and use it in GitHub Desktop.
#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef int (*orig_open_f_type)(const char *pathname, int flags);
typedef int (*orig_open64_f_type)(const char *pathname, int flags);
int open(const char *pathname, int flags){
orig_open_f_type orig_open;
orig_open = (orig_open_f_type)dlsym(RTLD_NEXT, "open");
printf(">>> open(): '%s'!!!\n", pathname);
return orig_open(pathname, flags);
}
int open64(const char *pathname, int flags){
orig_open64_f_type orig_open64;
orig_open64 = (orig_open64_f_type)dlsym(RTLD_NEXT, "open64");
printf(">>> open64(): '%s'!!!\n", pathname);
return orig_open64(pathname, flags);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment