mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-16 17:46:48 +00:00
Fix the invalid fd for F_GETFL and F_SETFL
This commit is contained in:
parent
41a1cfd169
commit
7e4a96fcdf
@ -28,7 +28,7 @@ pub fn sys_fcntl(fd: FileDescripter, cmd: i32, arg: u64) -> Result<SyscallReturn
|
|||||||
let current = current!();
|
let current = current!();
|
||||||
let file = {
|
let file = {
|
||||||
let file_table = current.file_table().lock();
|
let file_table = current.file_table().lock();
|
||||||
file_table.get_file(arg as FileDescripter)?.clone()
|
file_table.get_file(fd)?.clone()
|
||||||
};
|
};
|
||||||
let status_flags = file.status_flags();
|
let status_flags = file.status_flags();
|
||||||
let access_mode = file.access_mode();
|
let access_mode = file.access_mode();
|
||||||
@ -40,7 +40,7 @@ pub fn sys_fcntl(fd: FileDescripter, cmd: i32, arg: u64) -> Result<SyscallReturn
|
|||||||
let current = current!();
|
let current = current!();
|
||||||
let file = {
|
let file = {
|
||||||
let file_table = current.file_table().lock();
|
let file_table = current.file_table().lock();
|
||||||
file_table.get_file(arg as FileDescripter)?.clone()
|
file_table.get_file(fd)?.clone()
|
||||||
};
|
};
|
||||||
let new_status_flags = {
|
let new_status_flags = {
|
||||||
// This cmd can change(set or unset) only the O_APPEND, O_ASYNC, O_DIRECT,
|
// This cmd can change(set or unset) only the O_APPEND, O_ASYNC, O_DIRECT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user