mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +00:00
Make stat() work on device files again.
FileDescriptor will now keep a pointer to the original inode even after opening it resolves to a character device. Fixed up /bin/ls to display major and minor device numbers instead of size for device files.
This commit is contained in:
parent
c3cc318028
commit
c4fce9b3f9
8 changed files with 25 additions and 10 deletions
|
@ -1215,7 +1215,7 @@ int Process::sys$lstat(const char* path, stat* statbuf)
|
|||
if (!validate_write_typed(statbuf))
|
||||
return -EFAULT;
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(move(path), error, O_NOFOLLOW_NOERROR, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(move(path), error, O_NOFOLLOW_NOERROR | O_DONT_OPEN_DEVICE, 0, cwd_inode()->identifier());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
descriptor->fstat(statbuf);
|
||||
|
@ -1227,7 +1227,7 @@ int Process::sys$stat(const char* path, stat* statbuf)
|
|||
if (!validate_write_typed(statbuf))
|
||||
return -EFAULT;
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(move(path), error, 0, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(move(path), error, O_DONT_OPEN_DEVICE, 0, cwd_inode()->identifier());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
descriptor->fstat(statbuf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue