Exemplo n.º 1
0
int rename(const char *oldpath, const char *pathname) {
    static int (*real_rename)(const char *oldpath, const char *pathname) = NULL;
    const char *op, *pn;
    int ret;

    PRINTF("[wrp %5d] %s %s %s\n", getpid(), "rename", oldpath, pathname);   
    if (!real_rename) real_rename = dlsym(RTLD_NEXT, "rename"); 
    /* we can't use the std macros employed by all the other
       fuunctions because of the extra work we have to do around with
       wrapping both pathnames... */
    op = prepend_destdir(oldpath);
    pn = prepend_destdir(pathname);

    if (pn) {
	ret = real_rename(op ? op : oldpath, pn);
	/* putpath */
	free((void *)pn);
	if (ret == 0) {
	    if (op) free((void *)op);
	    return ret;
	}
    }
    ret = real_rename(op ? op : oldpath, pathname);
    if (op) free((void *)op);
    return ret;
}
Exemplo n.º 2
0
int rename(const char *oldpath, const char *newpath) {
	if(!real_rename)
		real_rename = dlsym(RTLD_NEXT, "rename");

	int ret = real_rename(oldpath, newpath);
	logdir(oldpath, ret);
	logdir(newpath, ret);
	return ret;
}
Exemplo n.º 3
0
int rename(char *oldname,char *newname)
{
    int p1, p2;
    p1 = smbw_path(oldname);
    p2 = smbw_path(newname);
    if (p1 ^ p2) {
        /* can't cross filesystem boundaries */
        errno = EXDEV;
        return -1;
    }
    if (p1 && p2) {
        return smbw_rename(oldname, newname);
    }

    return real_rename(oldname, newname);
}