mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
Utilities/mount: Resolve regression on mounting non-storage-backed FSes
Without this patch, we fail on manually mounting RAMFS (which I tested
for) but any filesystem that is not backed by actual storage will fail.
This bug was introduced in 0739b5df11
and
now is resolved by checking if the source fd is negative, to avoid fail
of the fstat call on it.
This commit is contained in:
parent
1a1191cc6e
commit
476b3703fd
Notes:
sideshowbarker
2024-07-17 04:32:07 +09:00
Author: https://github.com/supercomputer7
Commit: 476b3703fd
Pull-request: https://github.com/SerenityOS/serenity/pull/24156
1 changed files with 8 additions and 5 deletions
|
@ -262,10 +262,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else {
|
||||
if (fs_type.is_empty())
|
||||
fs_type = "ext2"sv;
|
||||
if (fd >= 0) {
|
||||
auto stat = TRY(Core::System::fstat(fd));
|
||||
if (!S_ISBLK(stat.st_mode))
|
||||
if (!S_ISBLK(stat.st_mode)) {
|
||||
TRY(mount_using_loop_device(fd, mountpoint, fs_type, flags));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
TRY(Core::System::mount(fd, mountpoint, fs_type, flags));
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue