示例#1
0
static int sys_chmod(char * file, int mode) {
    int result;
    PTR_VALIDATE(file);
    fs_node_t * fn = kopen(file, 0);
    if (fn) {
        result = chmod_fs(fn, mode);
        close_fs(fn);
        return result;
    } else {
        return -1;
    }
}
示例#2
0
文件: syscall.c 项目: klange/toaruos
static int sys_chmod(char * file, int mode) {
	int result;
	PTR_VALIDATE(file);
	fs_node_t * fn = kopen(file, 0);
	if (fn) {
		/* Can group members change bits? I think it's only owners. */
		if (current_process->user != 0 && current_process->user != fn->uid) {
			close_fs(fn);
			return -EACCES;
		}
		result = chmod_fs(fn, mode);
		close_fs(fn);
		return result;
	} else {
		return -ENOENT;
	}
}