remove.c 539 B

1234567891011121314151617181920
  1. #include <stdio.h>
  2. #include <dlfcn.h>
  3. #include <string.h>
  4. static int (*original_remove)(const char *pathname);
  5. static const char *HookPath = "/media/mmc/time_lapse/.setup";
  6. extern char TimeLapsePath[256];
  7. static void __attribute ((constructor)) remove_hook_init(void) {
  8. original_remove = dlsym(dlopen ("/lib/libc.so.0", RTLD_LAZY), "remove");
  9. }
  10. int remove(const char *pathname) {
  11. if(!strncmp(pathname, HookPath, strlen(HookPath))) printf("[webhook] time_lapse_finish %s\n", TimeLapsePath);
  12. return original_remove(pathname);
  13. }