int vfswrap_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) { #ifdef HAVE_NO_ACL errno = ENOSYS; return -1; #else int result; START_PROFILE(chmod_acl); result = chmod_acl(conn, name, mode); END_PROFILE(chmod_acl); return result; #endif }
/*! * chmod() wrapper for symlink and ACL handling * * @param path (r) path * @param mode (r) requested mode * @param sb (r) stat() of path or NULL * @param option (r) O_NOFOLLOW | O_NETATALK_ACL * * Options description: * O_NOFOLLOW: don't chmod() symlinks, do nothing, return 0 * O_NETATALK_ACL: call chmod_acl() instead of chmod() * O_IGNORE: ignore chmod() request, directly return 0 */ int ochmod(char *path, mode_t mode, const struct stat *st, int options) { struct stat sb; if (options & O_IGNORE) return 0; if (!st) { if (lstat(path, &sb) != 0) return -1; st = &sb; } if (options & O_NOFOLLOW) if (S_ISLNK(st->st_mode)) return 0; if (options & O_NETATALK_ACL) { return chmod_acl(path, mode); } else { return chmod(path, mode); } }