mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Kernel: Make sys$posix_fallocate() fail with ENODEV on non-regular files
Previously we tried to determine if `fd` refers to a non-regular file by doing a stat() operation on the file. This didn't work out very well since many File subclasses don't actually implement stat() but instead fall back to failing with EBADF. This patch fixes the issue by checking for regular files with File::is_regular_file() instead.
This commit is contained in:
parent
4dd148f07c
commit
961e1e590b
1 changed files with 2 additions and 1 deletions
|
@ -37,7 +37,8 @@ ErrorOr<FlatPtr> Process::sys$posix_fallocate(int fd, Userspace<off_t const*> us
|
|||
if (description->is_fifo())
|
||||
return ESPIPE;
|
||||
|
||||
if (!S_ISREG(TRY(description->file().stat()).st_mode))
|
||||
// [ENODEV] The fd argument does not refer to a regular file.
|
||||
if (!description->file().is_regular_file())
|
||||
return ENODEV;
|
||||
|
||||
VERIFY(description->file().is_inode());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue