int access(const char *path, int mode) { int ret; init_syms(); if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) { init_sysfs(); char *newpath; if (asprintf(&newpath, "%s/%s", fakesysfscgroupdir, path + strlen(SYSFS_CGROUP_PREFIX)) < 0) { errno = ENOMEM; return -1; } ret = real_access(newpath, mode); free(newpath); } else if (STREQ(path, "/proc/cgroups") || STREQ(path, "/proc/self/cgroup") || STREQ(path, SYSFS_CPU_PRESENT)) { /* These files are readable for all. */ ret = (mode == F_OK || mode == R_OK) ? 0 : -1; } else if (STREQ(path, "/proc/mounts")) { /* This one is accessible anytime for anybody. In fact, it's just * a symlink to /proc/self/mounts. */ ret = 0; } else { ret = real_access(path, mode); } return ret; }
int access(const char *pathname, int mode) { static int (*real_access)(const char *pathname, int mode) = NULL; const char *p; int ret; GET_PATH(access); if (p) { ret = real_access(p, mode); PUT_PATH(-1); } return real_access(pathname, mode); }
int access(const char *pathname, int mode) { int ret; DBG("enter: filename=%s\n", pathname); ret = real_access(pathname, mode); if (unlikely(-1 == ret) && mode == R_OK) { if (-1 == install_package_for(pathname)) return -1; else return real_access(pathname, mode); } return ret; }
int access(char *name, int mode) { if (smbw_path(name)) { return smbw_access(name, mode); } return real_access(name, mode); }
int access(const char *path, int amode) { // TODO: make this the same as stat (i.e., not lstat) if (!inside_libc && !action_lstat(path)) { errno = ENOENT; return -1; } return real_access(path, amode); }