Ejemplo n.º 1
0
int unlink (const char *path)
{
    char *msg;
    char *newpath = (char *)path;
    int ret = 0;
    int hackedPath = 0;

    if (next_unlink == NULL)
    {
        next_unlink = dlsym (RTLD_NEXT, "unlink");
        if ((msg = dlerror ()) != NULL)
        {
            printf ("open dlopen failed : %s\n", msg);
            return -1;
        }
    }

    /* Modifying path */
    if (!strncmp ("/etc/turboprint/tp_testfile.tst", path, 29))
    {
        newpath = (char *)malloc (strlen (getenv ("RBR")) + strlen (path) + 1);
        newpath = strcpy (newpath, getenv ("RBR"));
        newpath = strcat (newpath, path);
        //printf ("using hacked path %s for unlink\n", newpath);
        hackedPath = 1;
    }

    ret = next_unlink (newpath);
    if (hackedPath)
        free (newpath);
    return ret;
}
Ejemplo n.º 2
0
int unlink(const char *pathname){
  int r;
  INT_STRUCT_STAT st;


  r=INT_NEXT_LSTAT(pathname, &st);
  if(r)
    return -1;

  r=next_unlink(pathname);

  if(r)
    return -1;

  INT_SEND_STAT(&st, unlink_func);

  return 0;
}