mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user