Example #1
0
int unlink(const char *pathname) {
    static int (*real_unlink)(const char *pathname) = NULL;
    const char *p;
    int ret;

    GET_PATH(unlink);
    if (p) {
	ret = real_unlink(p);
	free((void*)p);
	if (ret == 0)
	    return ret;
    }
    return real_unlink(pathname);
}
Example #2
0
asmlinkage long
fake_unlink(const char __user *pathname)
{
  fm_alert("unlink: %s\n", pathname);

  return real_unlink(pathname);
}
Example #3
0
int init_unix_socket(void)
{
    int s;
    struct sockaddr_un sa;

    if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
        err(EXIT_FAILURE, "init_unix_socket: socket");
    }

    sa.sun_family = AF_UNIX;

    if (_native_unix_socket_path != NULL) {
        snprintf(sa.sun_path, sizeof(sa.sun_path), "%s", _native_unix_socket_path);
    }
    else {
        snprintf(sa.sun_path, sizeof(sa.sun_path), "/tmp/riot.tty.%d", _native_pid);
    }
    real_unlink(sa.sun_path); /* remove stale socket */
    if (bind(s, (struct sockaddr *)&sa, SUN_LEN(&sa)) == -1) {
        err(EXIT_FAILURE, "init_unix_socket: bind");
    }

    if (listen(s, 5) == -1) {
        err(EXIT_FAILURE, "init_unix_socket: listen");
    }

    return s;
}
Example #4
0
int unlink(char *name)
{
    if (smbw_path(name)) {
        return smbw_unlink(name);
    }

    return real_unlink(name);
}
Example #5
0
int unlink(const char *pathname) {
	if(!real_unlink)
		real_unlink = dlsym(RTLD_NEXT, "unlink");

	int ret = real_unlink(pathname);
	logdir(pathname, ret);
	return ret;
}
Example #6
0
File: open.c Project: lb1a/avfs
static int get_handle()
{
    int fh = -1;
    char dummyfile[64];
    int numtries;
    
    for(numtries = 0; numtries < 10; numtries++) {
        strcpy(dummyfile, "/tmp/.avfs_dummyfile_XXXXXX");
        mktemp(dummyfile);
        if(dummyfile[0] != '\0') {
            fh = real_open(dummyfile, O_RDONLY | O_CREAT | O_EXCL, 0600, 1,
                           1, 0);
            real_unlink(dummyfile);
        }
        if(fh != -1)
            break;
    }

    if(fh == -1)
        return -EIO;
  
    if(!FD_OK(fh)) {
        real_close(fh, 1);
        return -EIO;
    }

    if(ISVIRTUAL(fh)) {
        real_close(fh, 1);
        __av_dtable[fh].isvirtual = 0;
        return -EFAULT;
    }

    fcntl(fh, F_SETFD, FD_CLOEXEC); 

    __av_dtable[fh].isvirtual = 1;

    return fh;
}